{"id":273,"date":"2019-06-28T01:36:32","date_gmt":"2019-06-27T16:36:32","guid":{"rendered":"https:\/\/took.jp\/?p=273"},"modified":"2020-06-15T16:56:20","modified_gmt":"2020-06-15T07:56:20","slug":"post-273","status":"publish","type":"post","link":"https:\/\/took.jp\/tech-blog\/post-273\/","title":{"rendered":"\u3010\u691c\u8a3c\u3011cakephp\u306f\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u60aa\u3044\u306e\u304b"},"content":{"rendered":"<p>\u79c1\u306f\u4ed5\u4e8b\u3067cakephp\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u304c\u3001cakephp\u306b\u3064\u3044\u3066\u8abf\u3079\u3066\u3044\u308b\u3068\u3001\u300ccake\u3067\u7528\u610f\u3055\u308c\u305f\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u4f4e\u4e0b\u3059\u308b\u300d\u306a\u3093\u3066\u3053\u3068\u304c\u826f\u304f\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u52d5\u4f5c\u306e\u91cd\u3055\u3092\u611f\u3058\u3066\u3044\u305f\u306e\u3067\u3001\u3069\u308c\u304f\u3089\u3044\u306e\u5dee\u304c\u3042\u308b\u306e\u304b\u691c\u8a3c\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u691c\u8a3c\u65b9\u6cd5<\/h2>\n<p>\u4f7f\u3063\u3066\u3044\u308bcake\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306f\uff12\u7cfb\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001find\u30e1\u30bd\u30c3\u30c9\u306e\u52d5\u4f5c\u3068query\u30e1\u30bd\u30c3\u30c9\u306e\u52d5\u4f5c\uff08\u751f\u306eSQL\uff09\u306e\u901f\u5ea6\u3092\u6bd4\u8f03\u3057\u307e\u3059\u3002<\/p>\n<p>find\u30e1\u30bd\u30c3\u30c9\u3068\u306f\u3001cakephp\u3067\u7528\u610f\u3055\u308c\u305f\u8a18\u8ff0\u65b9\u6cd5\u3067\u3001sql\u306eselect\u6587\u306e\u30af\u30a8\u30ea\u3092\u767a\u884c\u3057\u3066\u304f\u308c\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u306f\u300127\u30ab\u30e9\u30e0\u3042\u308b\u30c6\u30fc\u30d6\u30eb\u306e\u7d0415000\u30ec\u30b3\u30fc\u30c9\u7a0b\u306e\u30e6\u30fc\u30b6\u60c5\u5831\u306e\u8a70\u307e\u3063\u305f\u30c7\u30fc\u30bf\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30c7\u30fc\u30bf\u3059\u3079\u3066\u3092\u53d6\u308a\u51fa\u3059\u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u3092ajax\u3067\u9023\u7d9a10\u56de\u3067\u547c\u3073\u51fa\u3057\u3092\u884c\u3063\u305f\u6642\u306e\u901f\u5ea6\u3092\u6bd4\u8f03\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\uff11.cakephp\u306efind\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3002<\/strong><\/p>\n<pre class=\"line-numbers\" data-start=\"1\"><code class=\"language-php\">public function test(){\r\n$options = array(\r\n'fields' =&gt; array(\r\n'*',\r\n),\r\n);\r\nreturn $this-&gt;find('all', $options);\r\n}<\/code><\/pre>\n<p><img decoding=\"async\" class=\"alignnone wp-image-274\" src=\"https:\/\/took.jp\/wp-content\/uploads\/2019\/06\/p1-300x91.png\" alt=\"\" width=\"455\" height=\"138\" srcset=\"https:\/\/took.jp\/tech-blog\/wp-content\/uploads\/2019\/06\/p1-300x91.png 300w, https:\/\/took.jp\/tech-blog\/wp-content\/uploads\/2019\/06\/p1-768x234.png 768w, https:\/\/took.jp\/tech-blog\/wp-content\/uploads\/2019\/06\/p1.png 1008w\" sizes=\"(max-width: 455px) 100vw, 455px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>\uff12.\u751f\u306esql\u3092\u5b9f\u884c\u3059\u308b<\/strong><\/p>\n<pre class=\"line-numbers\" data-start=\"1\"><code class=\"language-php\">public function test2(){\r\n$sql = \"SELECT * FROM\u00a0`t_users`;\";\r\n$data = $this-&gt;query($sql);\r\nreturn $data;\r\n}<\/code><\/pre>\n<p><img decoding=\"async\" class=\"alignnone wp-image-275\" src=\"https:\/\/took.jp\/wp-content\/uploads\/2019\/06\/p2-300x89.png\" alt=\"\" width=\"452\" height=\"134\" srcset=\"https:\/\/took.jp\/tech-blog\/wp-content\/uploads\/2019\/06\/p2-300x89.png 300w, https:\/\/took.jp\/tech-blog\/wp-content\/uploads\/2019\/06\/p2-768x229.png 768w, https:\/\/took.jp\/tech-blog\/wp-content\/uploads\/2019\/06\/p2.png 1001w\" sizes=\"(max-width: 452px) 100vw, 452px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u901f\u5ea6\u304c\u5168\u7136\u9055\u3044\u307e\u3059\u306d\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u30c7\u30fc\u30bf\u306e\u5bb9\u91cf\u304c\u591a\u3044\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u304c\u300170\u79d2\u307b\u3069\u304b\u304b\u3063\u3066\u3044\u305f\u51e6\u7406\u304c\u307b\u307c\u500d\u306e\u901f\u5ea6\u3067\u51e6\u7406\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>cakephp\u306efind\u30e1\u30bd\u30c3\u30c9\u306f\u30b4\u30df\u3067\u3059\u3002<\/p>\n<p>select\u3057\u3066\u8fd4\u3063\u3066\u304f\u308b\u914d\u5217\u306e\u5f62\u3082\u5acc\u3044\u3067\u3057\u305f\u304c\u3001\u51e6\u7406\u901f\u5ea6\u307e\u3067\u3082\u9045\u3044\u3068\u306a\u308b\u3068\u3001\u4f7f\u3046\u30e1\u30ea\u30c3\u30c8\u304c\u898b\u5f53\u305f\u3089\u306a\u3044\u3067\u3059\u3002<\/p>\n<p>\u4ed6\u306e\u4eba\u306e\u8a18\u4e8b\u3092\u898b\u3066\u3044\u308b\u611f\u3058\u3001\u305d\u306e\u4ed6cake\u3067\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u30e1\u30bd\u30c3\u30c9\u306f\u5168\u822c\u91cd\u3044\u3088\u3046\u3067\u3059\u306d...\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u79c1\u306f\u4ed5\u4e8b\u3067cakephp\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u304c\u3001cakephp\u306b\u3064\u3044\u3066\u8abf\u3079\u3066\u3044\u308b\u3068\u3001\u300ccake\u3067\u7528\u610f\u3055\u308c\u305f\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u4f4e\u4e0b\u3059\u308b\u300d\u306a\u3093\u3066\u3053\u3068\u304c\u826f\u304f\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002 \u5b9f\u969b\u306b\u52d5\u4f5c\u306e\u91cd\u3055\u3092\u611f\u3058\u3066\u3044\u305f\u306e\u3067\u3001\u3069\u308c\u304f\u3089\u3044\u306e\u5dee\u304c\u3042\u308b\u306e\u304b\u691c\u8a3c\u3057\u2026<\/p>\n","protected":false},"author":3,"featured_media":1996,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[84,62,67,68],"tags":[],"class_list":["post-273","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cakephp","category-it","category-php","category-68"],"_links":{"self":[{"href":"https:\/\/took.jp\/tech-blog\/wp-json\/wp\/v2\/posts\/273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/took.jp\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/took.jp\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/took.jp\/tech-blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/took.jp\/tech-blog\/wp-json\/wp\/v2\/comments?post=273"}],"version-history":[{"count":0,"href":"https:\/\/took.jp\/tech-blog\/wp-json\/wp\/v2\/posts\/273\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/took.jp\/tech-blog\/wp-json\/wp\/v2\/media\/1996"}],"wp:attachment":[{"href":"https:\/\/took.jp\/tech-blog\/wp-json\/wp\/v2\/media?parent=273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/took.jp\/tech-blog\/wp-json\/wp\/v2\/categories?post=273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/took.jp\/tech-blog\/wp-json\/wp\/v2\/tags?post=273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}