{"id":1067,"date":"2019-06-03T13:02:44","date_gmt":"2019-06-03T04:02:44","guid":{"rendered":"https:\/\/tech.at-iroha.jp\/?p=1067"},"modified":"2021-04-14T15:55:14","modified_gmt":"2021-04-14T06:55:14","slug":"cakephp2-x%e3%81%ab%e3%81%8a%e3%81%91%e3%82%8b%e3%83%91%e3%83%83%e3%82%b1%e3%83%bc%e3%82%b8%e3%81%a8%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e9%a0%98%e5%9f%9f%e3%81%ae%e5%88%86%e9%9b%a2","status":"publish","type":"post","link":"https:\/\/tech.at-iroha.jp\/?p=1067","title":{"rendered":"CakePHP2\u306b\u304a\u3051\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u3068\u30ab\u30b9\u30bf\u30e0\u9818\u57df\u306e\u5206\u96e2"},"content":{"rendered":"\n<p>2015\u5e74\u304b\u3089 CakePHP2.x\u3092\u30d9\u30fc\u30b9\u306b\u3001\u3042\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3092\u958b\u767a\u3057\u3066\u3044\u308b\u306e\u3060\u304c\u3001\u5b9f\u969b\u306b\u304a\u5ba2\u3055\u3093\u306b\u63d0\u4f9b\u3059\u308b\u969b\u3001\u6a5f\u80fd\u3084\u30c7\u30b6\u30a4\u30f3\u306e\u4e00\u90e8\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u3066\u63d0\u4f9b\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u3002<\/p>\n\n\n\n<p>\u3057\u304b\u3057\u30d1\u30c3\u30b1\u30fc\u30b8\u672c\u4f53\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306b\u624b\u3092\u5165\u308c\u3066\u3057\u307e\u3046\u3068\u3001\u5f8c\u3005\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u3057\u305f\u969b\u306b\u3001\u30de\u30fc\u30b8\u3059\u308b\u306e\u304c\u975e\u5e38\u306b\u7169\u96d1\u306b\u306a\u308b\u3002WordPress \u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3088\u3046\u306b\u3001CakePHP \u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u62e1\u5f35\u3059\u308b\u65b9\u6cd5\u3082\u691c\u8a0e\u3057\u3066\u307f\u305f\u304c\u3001\u5236\u7d04\u304c\u591a\u304f\u3001\u306a\u304b\u306a\u304b\u601d\u3046\u3088\u3046\u306b\u306f\u3044\u304b\u306a\u3044\u3002\u305d\u3053\u3067 CakePHP \u306e\u30af\u30e9\u30b9\u30d1\u30b9\u3092\u5229\u7528\u3057\u3001\u30bd\u30fc\u30b9\u306e\u8aad\u307f\u8fbc\u307f\u9806\u3092\u5236\u5fa1\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u672c\u4f53\u3068\u30ab\u30b9\u30bf\u30e0\u9818\u57df\u3092\u5206\u96e2\u3059\u308b\u3053\u3068\u3092\u8a66\u307f\u305f\u3002<\/p>\n\n\n\n<p>\u5177\u4f53\u7684\u306b\u306f\u3001CakePHP \u306e\u69cb\u6210\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3001Config\/bootstrap.php \u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8a2d\u5b9a\u3092\u884c\u3063\u305f\u3002 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u7528\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u767b\u9332\uff08\u3053\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u683c\u7d0d\u3055\u308c\u305f\u30bd\u30fc\u30b9\u3092\u512a\u5148\u3057\u3066\u8aad\u307f\u8fbc\u3080\uff09\nApp::build(\n    array(\n        'Model'                     =&gt; array(APP.'Custom'.DS.'Model'.DS),\n        'Model\/Behavior'            =&gt; array(APP.'Custom'.DS.'Model'.DS.'Behavior'.DS),\n        'Model\/Datasource'          =&gt; array(APP.'Custom'.DS.'Model'.DS.'Datasource'.DS),\n        'Model\/Datasource\/Database' =&gt; array(APP.'Custom'.DS.'Model'.DS.'Datasource'.DS.'Database'.DS),\n        'Model\/Datasource\/Session'  =&gt; array(APP.'Custom'.DS.'Model'.DS.'Datasource'.DS.'Session'.DS),\n        'Controller'                =&gt; array(APP.'Custom'.DS.'Controller'.DS),\n        'Controller\/Component'      =&gt; array(APP.'Custom'.DS.'Controller'.DS.'Component'.DS),\n        'Controller\/Component\/Auth' =&gt; array(APP.'Custom'.DS.'Controller'.DS.'Component'.DS.'Auth'.DS),\n        'Controller\/Component\/Acl'  =&gt; array(APP.'Custom'.DS.'Controller'.DS.'Component'.DS.'Acl'.DS),\n        'View'                      =&gt; array(APP.'Custom'.DS.'View'.DS),\n        'View\/Helper'               =&gt; array(APP.'Custom'.DS.'View'.DS.'Helper'.DS),\n        'Console'                   =&gt; array(APP.'Custom'.DS.'Console'.DS),\n        'Console\/Command'           =&gt; array(APP.'Custom'.DS.'Console'.DS.'Command'.DS),\n        'Lib'                       =&gt; array(APP.'Custom'.DS.'Lib'.DS),\n        'Locale'                    =&gt; array(APP.'Custom'.DS.'Locale'.DS),\n        'Vendor'                    =&gt; array(APP.'Custom'.DS.'Vendor'.DS),\n        'Plugin'                    =&gt; array(APP.'Custom'.DS.'Plugin'.DS),\n    )\n);<\/code><\/pre>\n\n\n\n<p>\u305d\u306e\u7d50\u679c\u3001Custom \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u672c\u4f53\u3068\u540c\u540d\u306e\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u914d\u7f6e\u3057\u305f\u5834\u5408\u3001 Custom \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4e0a\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u512a\u5148\u7684\u306b\u8aad\u307f\u8fbc\u3081\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002\u4f8b\u3048\u3070\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u306e View\/login.ctp \u3092 Custom\/View\/User \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30b3\u30d4\u30fc\u3057\u3001\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3092\u884c\u3046\u3002\u30d1\u30c3\u30b1\u30fc\u30b8\u5074\u306e\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u4fee\u6b63\u304c\u5165\u3089\u306a\u3044\u305f\u3081\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u5dee\u3057\u66ff\u3048\u3060\u3051\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u66f4\u65b0\u304c\u53ef\u80fd\u3068\u306a\u308b\u3002<\/p>\n\n\n\n<p>\u52a0\u3048\u3066\u3001\u540c\u3058\u304f  Config\/bootstrap.php  \u306b\u4ee5\u4e0b\u306e\u884c\u3092\u52a0\u3048\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001Custom \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u914d\u7f6e\u3057\u305f config.php \u30d5\u30a1\u30a4\u30eb\u306b\u3088\u3063\u3066\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u672c\u4f53\u306e\u8a2d\u5b9a\u306e\u4e0a\u66f8\u304d\u3001\u307e\u305f\u306f\u8ffd\u52a0\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u7528\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u30ed\u30fc\u30c9\nConfigure::config('default', new PhpReader(APP.'Custom'.DS.'Config'.DS));\nConfigure::load(\"config\");<\/code><\/pre>\n\n\n\n<p>\u307e\u305f View\/Layouts\/default.php \u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3001\u5168\u753b\u9762\u3067\u300ccustom.css\u300d\u3068\u300ccustom.js\u300d\u3092\u8aad\u307f\u8fbc\u307f\u3001\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u7528\u306e CSS \u3068JavaScript \u3092\u8ffd\u52a0\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo $this-&gt;Html-&gt;css('custom.css'); \/\/ \u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u7528CSS\necho $this-&gt;Html-&gt;script('custom.js'); \/\/ \u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u7528\u30b9\u30af\u30ea\u30d7\u30c8<\/code><\/pre>\n\n\n\n<p>\u30d6\u30e9\u30a6\u30b6\u3067 \/update \u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u672c\u4f53\u306e\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3068\u3001\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u7528\u306e\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u304c\u540c\u6642\u306b\u884c\u308f\u308c\u308b\u3002<\/p>\n\n\n\n<p>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u3092\u56f3\u306b\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u901a\u308a\u3068\u306a\u308b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"733\" src=\"https:\/\/tech.at-iroha.jp\/wp-content\/uploads\/2019\/06\/custom-1024x733.png\" alt=\"\" class=\"wp-image-1068\" srcset=\"https:\/\/tech.at-iroha.jp\/wp-content\/uploads\/2019\/06\/custom-1024x733.png 1024w, https:\/\/tech.at-iroha.jp\/wp-content\/uploads\/2019\/06\/custom-700x501.png 700w, https:\/\/tech.at-iroha.jp\/wp-content\/uploads\/2019\/06\/custom-768x550.png 768w, https:\/\/tech.at-iroha.jp\/wp-content\/uploads\/2019\/06\/custom.png 1417w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption><br><\/figcaption><\/figure>\n\n\n\n<p>\u3053\u308c\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u672c\u4f53\u3068\u30ab\u30b9\u30bf\u30e0\u9818\u57df\u3092\u4e00\u5fdc\u306f\u5206\u96e2\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3068\u306a\u3063\u305f\u3002\u3057\u304b\u3057\u306a\u304c\u3089\u3001\u3053\u306e\u65b9\u6cd5\u3067\u306f\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\u5358\u4f4d\u3067\u306e\u5dee\u5206\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3044\uff08\u4f8b\u3048\u3070 UsersContoller.php \u306e\u7279\u5b9a\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u66f8\u304d\u63db\u3048\u305f\u3044\u3060\u3051\u5834\u5408\u3082\u3001\u30bd\u30fc\u30b9\u3092\u4e38\u3054\u3068\u30b3\u30d4\u30fc\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002 \uff09\u3001\u307e\u3060\u6539\u5584\u306e\u4f59\u5730\u304c\u3042\u308b\u3088\u3046\u306b\u601d\u3046\u3002<\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>2015\u5e74\u304b\u3089 CakePHP2.x\u3092\u30d9\u30fc\u30b9\u306b\u3001\u3042\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3092\u958b\u767a\u3057\u3066\u3044\u308b\u306e\u3060\u304c\u3001\u5b9f\u969b\u306b\u304a\u5ba2\u3055\u3093\u306b\u63d0\u4f9b\u3059\u308b\u969b\u3001\u6a5f\u80fd\u3084\u30c7\u30b6\u30a4\u30f3\u306e\u4e00\u90e8\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u3066\u63d0\u4f9b\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u3002 \u3057\u304b\u3057\u30d1\u30c3\u30b1\u30fc\u30b8\u672c\u4f53\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1068,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,19],"tags":[],"class_list":["post-1067","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cakephp","category-oss"],"_links":{"self":[{"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/posts\/1067","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1067"}],"version-history":[{"count":14,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/posts\/1067\/revisions"}],"predecessor-version":[{"id":1394,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/posts\/1067\/revisions\/1394"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=\/wp\/v2\/media\/1068"}],"wp:attachment":[{"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.at-iroha.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}