{"id":1753,"date":"2011-01-24T19:46:05","date_gmt":"2011-01-24T10:46:05","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/archives\/1753"},"modified":"2011-01-26T14:00:30","modified_gmt":"2011-01-26T05:00:30","slug":"cakephp-%e3%81%af%e3%83%9e%e3%83%8b%e3%83%a5%e3%82%a2%e3%83%ab%e7%84%a1%e3%81%97%e3%81%a7%e3%82%b5%e3%82%a4%e3%83%88%e3%82%92%e4%bd%9c%e3%82%8c%e3%82%8b%e3%81%ae%e3%81%8b%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/1753","title":{"rendered":"CakePHP \u306f\u30de\u30cb\u30e5\u30a2\u30eb\u7121\u3057\u3067\u30b5\u30a4\u30c8\u3092\u4f5c\u308c\u308b\u306e\u304b\uff1f"},"content":{"rendered":"<p>\u3069\u3046\u3044\u3046\u624b\u9806\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u306e\u304b\u3001\u3063\u3066\u3053\u3068\u3067\u3059\u306d\u3002<\/p>\n<p>CakePHP\u30d6\u30ed\u30b0\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb :: \u958b\u767a\u4f8b :: \u30de\u30cb\u30e5\u30a2\u30eb :: 1.2\u30b3\u30ec\u30af\u30b7\u30e7\u30f3 :: The Cookbook<br \/>\n<a href=\"http:\/\/book.cakephp.org\/ja\/view\/219\/CakePHP\u30d6\u30ed\u30b0\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\">http:\/\/book.cakephp.org\/ja\/view\/219\/CakePHP\u30d6\u30ed\u30b0\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/a><\/p>\n<p>\u6700\u521d\u306f\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u624b\u3092\u4ed8\u3051\u308b\u308f\u3051\u3067\u3059\u304c\u3001\u3055\u3066\u3001\u30b5\u30a4\u30c8\u3092\u4f5c\u308b\u6642\u306f\u3069\u3053\u304b\u3089\u4f5c\u308a\u59cb\u3081\u308b\u306e\u304b\u3001\u3068\u3044\u3046\u3068\u3001CakePHP \u306f\u9762\u767d\u3044\u3053\u3068\u306b\u30d6\u30e9\u30a6\u30b6\u306b URL \u3092\u5165\u529b\u3059\u308b\u3068\u3053\u308d\u304b\u3089\u59cb\u3081\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_04org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_04thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u3072\u3068\u307e\u305a\u3001\u3053\u3053\u307e\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u8a2d\u5b9a\u3057\u305f\u5f8c\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u30d6\u30e9\u30a6\u30b6\u3067\u5165\u529b\u3059\u308b\u30a2\u30c9\u30ec\u30b9\u3092\u5165\u308c\u307e\u3059\u3002<\/p>\n<p>http:\/\/cake.moonmile.net\/Products<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_05org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_05thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u3059\u308b\u3068\u3001\u30a8\u30e9\u30fc\u304c\u3067\u307e\u3059\u3002\u5f53\u305f\u308a\u524d\u3067\u3059\u304c\u3001\u3053\u306e\u30a8\u30e9\u30fc\u3092\u5143\u306b\u66f8\u304d\u9032\u3081\u308b\u308f\u3051\u3067\u3059\u3002<\/p>\n<ul>\n<li>ProductsController \u30af\u30e9\u30b9\u304c\u7121\u3044\u3088\u3002<\/li>\n<li>app\/controllers\/products_controller.php \u306e\u30d5\u30a1\u30a4\u30eb\u306b\u7f6e\u3051\u3070\u3044\u3044\u3002<\/li>\n<li>\u3072\u3068\u307e\u305a\u3001\u4e0b\u8a18\u3092\u8cbc\u308a\u3064\u3051\u308c\u3070 OK\u3002<\/li>\n<\/ul>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\nclass ProductsController extends AppController {\r\n\r\n\tvar $name = &#039;Products&#039;;\r\n}\r\n?&gt;\r\n<\/pre>\n<p>\u3068\u3044\u3046\u8a33\u3067\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<p>\u518d\u3073 http:\/\/cake.moonmile.net\/Products \u306e\u30a2\u30c9\u30ec\u30b9\u306b\u63a5\u7d9a\u3059\u308b\u3068\u3001\u30a8\u30e9\u30fc\u304c\u5909\u308f\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_06org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_06thum.jpg\" border=\"0\" \/><\/a><\/p>\n<ul>\n<li>\u30e2\u30c7\u30eb\u306e Product \u306e\u305f\u3081\u306e products \u3068\u3044\u3046\u30c6\u30fc\u30d6\u30eb\u304c\u7121\u3044\u3088\u3002<\/li>\n<\/ul>\n<p>\u3063\u3066\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<p>\u203b \u305f\u3060\u3057\u3001IIS+PHP+MySQL \u306e\u74b0\u5883\u3067\u306f\u3001\u3053\u3053\u3067 500 \u306e\u30b5\u30fc\u30d0\u30fc\u30a8\u30e9\u30fc\u304c\u51fa\u307e\u3059\u3002\u3061\u3087\u3063\u3068\u3001\u3053\u308c\u306f\u4e0d\u4fbf\u3002\u4f55\u6545\u3001500 \u30a8\u30e9\u30fc\u306a\u306e\u304b\u306f\u4e0d\u660e\u3067\u3059\u304c\u3001Linux \u4e0a\u3067 PHP+MySQL \u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u306f\u3001\u3053\u306e\u901a\u308a\u306b\u52d5\u304d\u307e\u3059\u3002<\/p>\n<p>\u203b \u66ab\u5b9a\u3067\u3059\u304c\u3001\/cake\/libs\/error.php \u306e254 \u884c\u76ee\u3050\u3089\u3044\u306b\u3042\u308b missingTable \u95a2\u6570\u5185\u306e $this-&gt;controller-&gt;header(&#8220;HTTP\/1.0 500 Internal Server Error&#8221;) \u306e\u884c\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3059\u308b\u3068\u3001\u30c6\u30fc\u30d6\u30eb\u304c\u7121\u3044\u3068\u304d\u306e 500 \u30a8\u30e9\u30fc\u3092\u56de\u907f\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u3046\u3044\u3046\u8a33\u3067\u3001phpMysqlAdmin \u306a\u3069\u3092\u4f7f\u3063\u3066 products \u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\ncreate table products (\r\n  id int not null,\r\n  name varchar(50) not null,\r\n  price int not null\r\n)\r\n<\/pre>\n<p>\u30c7\u30fc\u30bf\u3082\u9069\u5f53\u306b\u5165\u308c\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\ninsert into products values ( 1, 'product 1st', 1000 );\r\ninsert into products values ( 2, 'product 2nd', 1000 );\r\ninsert into products values ( 3, 'product 3rd', 1000 );\r\n<\/pre>\n<p>\u518d\u3073 http:\/\/cake.moonmile.net\/Products \u306e\u30a2\u30c9\u30ec\u30b9\u306b\u63a5\u7d9a\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_07org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_07thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u4eca\u5ea6\u306f\u3001<\/p>\n<ul>\n<li>ProductsController \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b index \u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u304c\u7121\u3044\u3002<\/li>\n<li>\u307e\u3042\u3001\u3060\u3044\u305f\u3044\u3053\u3093\u306a\u98a8\u306b\u66f8\u304f\u3002<\/li>\n<\/ul>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\nclass ProductsController extends AppController {\r\n\r\n\tvar $name = &#039;Products&#039;;\r\n\r\n\tfunction index() {\r\n\r\n\t}\r\n\r\n}\r\n?&gt;\r\n<\/pre>\n<p>\u3068\u3044\u3046\u8a33\u3067\u3001index \u30e1\u30bd\u30c3\u30c9\u306e\u4e2d\u8eab\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<p>\u518d\u3073\u3001\u30d6\u30e9\u30a6\u30b6\u3092\u30ea\u30ed\u30fc\u30c9\u3059\u308b\u3068\u3001\u307e\u305f\u30a8\u30e9\u30fc\u304c\u5909\u308f\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_08org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_08thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u4eca\u5ea6\u306f ProductsController::index() \u306b\u5bfe\u5fdc\u3059\u308b\u30d3\u30e5\u30fc\u304c\u7121\u3044\u305d\u3046\u3067\u3059\u3002<br \/>\n\u30d3\u30e5\u30fc\u306f\u3001app\/views\/products\/index.ctp \u306b\u4f5c\u308a\u306a\u3055\u3044\u3001\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n<p>\u3053\u3053\u3067\u30d3\u30e5\u30fc\u3092\u9069\u5f53\u306b\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;p&gt;\u3053\u308c\u306f products \u30c6\u30fc\u30d6\u30eb\u306e\u305f\u3081\u306e\u30d3\u30e5\u30fc\u3067\u3059\u3002&lt;\/p&gt;\r\n&lt;?php\r\n\r\n?&gt;\r\n<\/pre>\n<p>\u518d\u3073\u3001\u30d6\u30e9\u30a6\u30b6\u3092\u30ea\u30ed\u30fc\u30c9\u3059\u308b\u3068\u3001<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_09org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_09thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u3081\u3067\u305f\u304f\u30a8\u30e9\u30fc\u304c\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&#8230;\u3063\u3066\u3001\u30c6\u30fc\u30d6\u30eb\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3068\u30d3\u30e5\u30fc\u3092\u76f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\nclass ProductsController extends AppController {\r\n\r\n\tvar $name = &#039;Products&#039;;\r\n\r\n\tfunction index() {\r\n\t\t$this-&gt;set(&#039;Products&#039;, $this-&gt;Product-&gt;find(&#039;all&#039;));\r\n\t}\r\n}\r\n?&gt;\r\n<\/pre>\n<p>Product \u30e2\u30c7\u30eb\u304b\u3089\u691c\u7d22\u3057\u3066\u3001\u30d3\u30e5\u30fc\u306b Products \u3068\u3044\u3046\u540d\u524d\u3067\u5f15\u304d\u6e21\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_10org.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_10thum.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u3053\u308c\u306b\u5408\u308f\u305b\u3066\u3001\u30d3\u30e5\u30fc\u3082\u5909\u3048\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;p&gt;\u3053\u308c\u306f products \u30c6\u30fc\u30d6\u30eb\u306e\u305f\u3081\u306e\u30d3\u30e5\u30fc\u3067\u3059\u3002&lt;\/p&gt;\r\n\r\n&lt;table&gt;\r\n\t&lt;tr&gt;\r\n\t\t&lt;th&gt;id&lt;\/th&gt;\r\n\t\t&lt;th&gt;name&lt;\/th&gt;\r\n\t\t&lt;th&gt;price&lt;\/th&gt;\r\n\t&lt;\/tr&gt;\r\n&lt;?php foreach($Products as $item) : ?&gt;\r\n\t&lt;tr&gt;\r\n\t\t&lt;td&gt;&lt;?php echo $item&#x5B;&#039;Product&#039;]&#x5B;&#039;id&#039;] ?&gt;&lt;\/td&gt;\r\n\t\t&lt;td&gt;&lt;?php echo $item&#x5B;&#039;Product&#039;]&#x5B;&#039;name&#039;] ?&gt;&lt;\/td&gt;\r\n\t\t&lt;td&gt;&lt;?php echo $item&#x5B;&#039;Product&#039;]&#x5B;&#039;price&#039;] ?&gt;&lt;\/td&gt;\r\n\t&lt;\/tr&gt;\r\n&lt;?php endforeach ; ?&gt;\r\n&lt;\/table&gt;\r\n<\/pre>\n<p>\u3053\u3053\u307e\u3067\u304d\u305f\u3089\u3001\u304d\u3061\u3093\u3068\u8868\u793a\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_10org1.jpg\"><img decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2011\/01\/wpid-dworkblogimage20110124_10thum1.jpg\" border=\"0\" \/><\/a><\/p>\n<p>\u3053\u3046\u3044\u3046\u98a8\u306b\u3072\u306a\u578b\u3092\u4f5c\u308b\u3063\u3066\u611f\u3058\u3067\u3057\u3087\u3046\u306d\u3002<\/p>\n<p>\u3088\u304f\u3067\u304d\u3066\u3044\u308b\u3068\u3044\u3046\u304b\u611f\u5fc3\u3059\u308b\u306e\u304c\u3001\u8db3\u308a\u306a\u3044\u90e8\u5206\u3092\u5358\u7d14\u306a\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u306e\u8868\u793a\u3067\u306f\u306a\u304f\u3066\u3001\u8db3\u308a\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3001\u8db3\u308a\u306a\u3044\u30e1\u30bd\u30c3\u30c9\u306e\u5185\u5bb9\u307e\u3067\u3092\u8868\u793a\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3067\u3059\u3002 ASP.NET MVC \u306e\u5834\u5408\u306f\u3001\u3053\u3093\u306a\u98a8\u306b\u306f\u3067\u304d\u3066\u3044\u306a\u304f\u3066\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u3001\u3069\u3046\u3057\u3066\u3082\u3001\u30e2\u30c7\u30eb\u2192\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u2192\u30d3\u30e5\u30fc\u306e\u9806\u5e8f\u3067\u4f5c\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059(\u30a8\u30e9\u30fc\u3092\u898b\u306a\u304c\u3089\u3084\u3063\u3066\u3082\u3044\u3044\u3093\u3067\u3057\u3087\u3046\u3051\u3069)\u3002<\/p>\n<p>\u3053\u306e\u3042\u305f\u308a\u306f\u3001PHP \u304c\u30b9\u30af\u30ea\u30d7\u30c8\u8a00\u8a9e\u3067\u3042\u308b\u5229\u70b9\u3092\u6709\u52b9\u306b\u6d3b\u7528\u3057\u3066\u3044\u308b\u306e\u304b\u306a\u3068\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3069\u3046\u3044\u3046\u624b\u9806\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u306e\u304b\u3001\u3063\u3066\u3053\u3068\u3067\u3059\u306d\u3002 CakePHP\u30d6\u30ed\u30b0\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb :: \u958b\u767a\u4f8b :: \u30de\u30cb\u30e5\u30a2\u30eb :: 1.2\u30b3\u30ec\u30af\u30b7\u30e7\u30f3 :: The Cookbook http:\/\/book.cak &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/1753\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[20],"tags":[],"class_list":["post-1753","post","type-post","status-publish","format-standard","hentry","category-cakephp"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/1753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=1753"}],"version-history":[{"count":6,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/1753\/revisions"}],"predecessor-version":[{"id":1761,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/1753\/revisions\/1761"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=1753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=1753"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=1753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}