{"id":128,"date":"2012-01-03T23:10:05","date_gmt":"2012-01-04T07:10:05","guid":{"rendered":"http:\/\/h2plus.biz\/hiromitsu\/?p=128"},"modified":"2018-08-06T14:54:35","modified_gmt":"2018-08-06T21:54:35","slug":"zend-framework%e3%81%a7ini%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e5%88%86%e6%95%a3%e7%ae%a1%e7%90%86%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/h2plus.biz\/hiromitsu\/entry\/128","title":{"rendered":"Zend Framework\u3067INI\u30d5\u30a1\u30a4\u30eb\u3092\u5206\u6563\u7ba1\u7406\u3059\u308b"},"content":{"rendered":"<p>Zend Framework\u3092\u4f7f\u3063\u3066\u958b\u767a\u3092\u9032\u3081\u3066\u3044\u304f\u3068\u3001\u5229\u7528\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u5897\u3048\u3066\u3044\u304f\u306b\u3064\u308c\u3066\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306eINI\u30d5\u30a1\u30a4\u30eb\uff08\u4e00\u822c\u7684\u306b\u4f7f\u308f\u308c\u3066\u3044\u308b<code>application.ini<\/code>\uff09\u306e\u5185\u5bb9\u304c\u81a8\u3089\u3093\u3067\u3044\u304f\u3002\u7279\u306bZend Framework\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u306b\u4f34\u3063\u3066\u3001<a href=\"https:\/\/framework.zend.com\/manual\/1.12\/ja\/zend.application.available-resources.html\" class=\"broken_link\">Zend_Application\u304b\u3089\u5229\u7528\u3067\u304d\u308b\u30ea\u30bd\u30fc\u30b9\u30d7\u30e9\u30b0\u30a4\u30f3<\/a>\u306e\u7a2e\u985e\u304c\u5145\u5b9f\u3057\u3066\u3044\u304f\u306e\u3067\u3001\u30bd\u30fc\u30b9\u4e2d\u306b\u30cf\u30fc\u30c9\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3057\u3066\u3044\u305f\u3088\u3046\u306a\u74b0\u5883\u4f9d\u5b58\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001\u3069\u3093\u3069\u3093INI\u30d5\u30a1\u30a4\u30eb\u306b\u79fb\u884c\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u304f\u3002<code>application.ini<\/code>\u30d5\u30a1\u30a4\u30eb\u5185\u3067\u306f\u3001\u3067\u304d\u308b\u3060\u3051\u30ea\u30bd\u30fc\u30b9\u6bce\u306b\u307e\u3068\u3081\u3066\u66f8\u304f\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u304c\u3001INI\u30d5\u30a1\u30a4\u30eb\u3092\u30ea\u30bd\u30fc\u30b9\u6bce\u306b\u5206\u3051\u3066\u7ba1\u7406\u3067\u304d\u306a\u3044\u3082\u306e\u304b\u3068\u601d\u3063\u3066\u3044\u305f\u3002<\/p>\n<p><!--more--><br \/>\n<a href=\"https:\/\/framework.zend.com\/manual\/1.12\/ja\/zend.application.quick-start.html\" class=\"broken_link\">Zend_Application\u30af\u30ea\u30c3\u30af\u30b9\u30bf\u30fc\u30c8<\/a>\u306b\u3042\u308b\u3088\u3046\u306b\u3001<\/p>\n<pre>\nzf create project h2plus\n<\/pre>\n<p>\u3068\u3001Zend_Tool\u3092\u4f7f\u3063\u3066\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u308b\u3068\u3001<code>configs<\/code>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u3067\u304d\u3066\u3001\u305d\u306e\u4e2d\u306b<code>application.ini<\/code>\u3060\u3051\u304c\u81ea\u52d5\u751f\u6210\u3055\u308c\u308b\u3002\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u304c\u8907\u6570\u5f62\u306e<code>configs<\/code>\u3068\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u304b\u3089\u3001\u8907\u6570\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3059\u308b\u5834\u6240\u3068\u3057\u3066\u8a2d\u8a08\u3055\u308c\u3066\u3044\u308b\u3068\u8aad\u307f\u53d6\u308c\u308b\u304c\u3001\u305f\u3044\u3066\u3044\u306e\u4eba\u306f\u552f\u4e00\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb<code>application.ini<\/code>\u306b\u3059\u3079\u3066\u306e\u8a2d\u5b9a\u3092\u653e\u308a\u8fbc\u3093\u3067\u3044\u308b\u306e\u3067\u306f\u306a\u3044\u3060\u308d\u3046\u304b\u3002<\/p>\n<p>\u524d\u7f6e\u304d\u306f\u3053\u306e\u304f\u3089\u3044\u306b\u3057\u3066\u65e9\u901f\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3002<\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30d6\u30fc\u30c8\u30b9\u30c8\u30e9\u30c3\u30d7\uff08<code>application\/Bootstrap.php<\/code>\uff09\u306b\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a<code>_initConfig()<\/code>\u95a2\u6570\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nclass Bootstrap extends Zend_Application_Bootstrap_Bootstrap\r\n{\r\n    protected function _initConfig()\r\n    {\r\n        $this-&amp;amp;amp;amp;gt;bootstrap('frontController');\r\n        $exclude = array('.', '..', APPLICATION_CONFIG);\r\n\r\n        $dir = dir(APPLICATION_PATH.'\/configs');\r\n        while(($file = $dir-&amp;amp;amp;amp;gt;read()) !== false)\r\n        {\r\n            if(!in_array($file, $exclude) &amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp; fnmatch('*.ini', $file))\r\n            {\r\n                $config = new Zend_Config_Ini(&amp;amp;amp;amp;quot;$dir-&amp;amp;amp;amp;gt;path\/$file&amp;amp;amp;amp;quot;, APPLICATION_ENV);\r\n                $this-&amp;amp;amp;amp;gt;setOptions($config-&amp;amp;amp;amp;gt;toArray());\r\n            }\r\n        }\r\n        $dir-&amp;amp;amp;amp;gt;close();\r\n    }\r\n}\r\n<\/pre>\n<p>\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u5358\u7d14\u3002<code>application\/configs<\/code>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u3092\u8d70\u67fb\u3057\u3066\u3001INI\u30d5\u30a1\u30a4\u30eb\u3092\u898b\u3064\u3051\u305f\u3089Zend_Config_Ini\u3092\u4f7f\u3063\u3066\u30ed\u30fc\u30c9\u3057\u3066\u3044\u308b\u3060\u3051\u30026\u884c\u76ee\u306e<code>APPLICATION_CONFIG<\/code>\u306f\u3001Zend_Application\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306b\u6e21\u3059\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u4e00\u81f4\u3059\u308b\u3082\u306e\u306a\u306e\u3067\u3001<code>public\/index.php<\/code>\u5185\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\ndefine('APPLICATION_CONFIG', 'application.ini');\r\n\r\n\/\/ Create application, bootstrap, and run\r\n$application = new Zend_Application(\r\n    APPLICATION_ENV,\r\n    APPLICATION_PATH . '\/configs\/' . APPLICATION_CONFIG\r\n);\r\n<\/pre>\n<p>\u30bd\u30fc\u30b9\u306e\u4fee\u6b63\u306f\u3053\u308c\u3060\u3051\u3002\u3042\u3068\u306f\u3001\u81a8\u3089\u3093\u3060<code>application.ini<\/code>\u3092\u7ba1\u7406\u3057\u3084\u3059\u3044\u3088\u3046\u306b\u5206\u5272\u3057\u3066\u3044\u3051\u3070\u3044\u3044\u3002\u4f8b\u3048\u3070\u3001<code>resources.db.*<\/code>\u306e\u8a2d\u5b9a\u3092<code>db.ini<\/code>\u306b\u3001<code>resources.mail.*<\/code>\u3092<code>mail.ini<\/code>\u3068\u3044\u3063\u305f\u611f\u3058\u3067\u3059\u3002<code>_initConfig()<\/code>\u3092\u3082\u3046\u5c11\u3057\u6539\u826f\u3057\u3066\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u5225\u306bINI\u30d5\u30a1\u30a4\u30eb\u3092\u5206\u5272\u3059\u308b\u3068\u3044\u3046\u306e\u3082\u30a2\u30ea\u304b\u3082\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Zend Framework\u3092\u4f7f\u3063\u3066\u958b\u767a\u3092\u9032\u3081\u3066\u3044\u304f\u3068\u3001\u5229\u7528\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u5897\u3048\u3066\u3044\u304f\u306b\u3064\u308c\u3066\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306eINI\u30d5\u30a1\u30a4\u30eb\uff08\u4e00\u822c\u7684\u306b\u4f7f\u308f\u308c\u3066\u3044\u308bapplication.ini\uff09\u306e\u5185\u5bb9\u304c\u81a8\u3089\u3093\u3067\u3044\u304f\u3002\u7279\u306bZend <a href='https:\/\/h2plus.biz\/hiromitsu\/entry\/128' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[62,17,60,61],"_links":{"self":[{"href":"https:\/\/h2plus.biz\/hiromitsu\/wp-json\/wp\/v2\/posts\/128"}],"collection":[{"href":"https:\/\/h2plus.biz\/hiromitsu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h2plus.biz\/hiromitsu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h2plus.biz\/hiromitsu\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/h2plus.biz\/hiromitsu\/wp-json\/wp\/v2\/comments?post=128"}],"version-history":[{"count":4,"href":"https:\/\/h2plus.biz\/hiromitsu\/wp-json\/wp\/v2\/posts\/128\/revisions"}],"predecessor-version":[{"id":1024,"href":"https:\/\/h2plus.biz\/hiromitsu\/wp-json\/wp\/v2\/posts\/128\/revisions\/1024"}],"wp:attachment":[{"href":"https:\/\/h2plus.biz\/hiromitsu\/wp-json\/wp\/v2\/media?parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h2plus.biz\/hiromitsu\/wp-json\/wp\/v2\/categories?post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h2plus.biz\/hiromitsu\/wp-json\/wp\/v2\/tags?post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}