{"id":402,"date":"2018-08-21T14:50:30","date_gmt":"2018-08-21T06:50:30","guid":{"rendered":"http:\/\/blog.yyhcw.com\/?p=402"},"modified":"2018-08-21T14:50:30","modified_gmt":"2018-08-21T06:50:30","slug":"thinkcmf%e5%ae%89%e8%a3%85%e5%9c%a8%e4%ba%8c%e7%ba%a7%e7%9b%ae%e5%bd%95%e9%97%ae%e9%a2%98%e4%b9%8b%e6%a8%a1%e6%9d%bf%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"http:\/\/blog.yyhcw.com\/post\/402.html","title":{"rendered":"thinkcmf\u5b89\u88c5\u5728\u4e8c\u7ea7\u76ee\u5f55\u95ee\u9898\u4e4b\u6a21\u677f\u5b89\u88c5"},"content":{"rendered":"<!--wp-compress-html--><!--wp-compress-html no compression--><p>\u4e4b\u524d\u5f88\u65e9\u7684\u65f6\u5019\u6709\u4e86\u89e3\u8fc7<a href=\"http:\/\/blog.yyhcw.com\/post\/tag\/thinkcmf\" class=\"tag-tooltip\" data-toggle=\"tooltip\" title=\"\u67e5\u770b\u66f4\u591a\u5173\u4e8e thinkcmf \u7684\u6587\u7ae0\" target=\"_blank\">thinkcmf<\/a>\uff0c\u4e0d\u8fc7\u5f53\u65f6\u5e76\u6ca1\u6709\u8be6\u7ec6\u4e86\u89e3\u5176\u5177\u4f53\u6d41\u7a0b\uff0c\u8fd9\u4e24\u5929\u60f3\u5728wordpress\u535a\u5ba2\u4e2d\u589e\u52a0\u4e2a\u4e8c\u7ea7\u76ee\u5f55\u653e<a href=\"http:\/\/blog.yyhcw.com\/post\/tag\/thinkcmf\" class=\"tag-tooltip\" data-toggle=\"tooltip\" title=\"\u67e5\u770b\u66f4\u591a\u5173\u4e8e thinkcmf \u7684\u6587\u7ae0\" target=\"_blank\">thinkcmf<\/a>\u7a0b\u5e8f\uff0c\u4e3b\u8981\u8fd8\u662f\u5bf9WP\u4e0d\u719f\u6089\u7684\u539f\u56e0\uff0c\u6682\u65f6\u4e5f\u6ca1\u60f3\u53bb\u8be6\u7ec6\u4e86\u89e3\u8fd9\u4e2a\u535a\u5ba2\u7a0b\u5e8f\uff0c\u6240\u4ee5\u61d2\u5f97\u627e\u5404\u79cd\u8d44\u6599\uff0c\u4e8e\u662f\u5c31\u6709\u4e86\u5728\u4e8c\u7ea7\u76ee\u5f55\u4e2d\u5b89\u88c5thinkcmf\u7684\u60f3\u6cd5\uff01\u5bf9\u4e8ethinkcmf\u8fd9\u91cc\u4e0d\u505a\u8fc7\u591a\u4ecb\u7ecd\uff0c\u8be6\u60c5\u8bf7\u79fb\u6b65thinkcmf\u5b98\u65b9\uff1a<a href=\"https:\/\/www.thinkcmf.com\/\">https:\/\/www.thinkcmf.com\/<\/a>\u3002<\/p>\n<p>\u6211\u8fd9\u91cc\u6240\u8bf4\u7684\u4e8c\u7ea7\u76ee\u5f55\uff0c\u88ab\u6211\u547d\u540d\u4e3a\uff1achongzhi\uff0c\u6240\u6709thinkcmf\u7a0b\u5e8f\u90fd\u653e\u5728chongzhi\u76ee\u5f55\u4e0b\uff1a<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-403 aligncenter\" src=\"http:\/\/blog.yyhcw.com\/wp-content\/uploads\/2018\/08\/21\/blog.yyhcw.com_2018-08-21_14-35-08.png\" alt=\"thinkcmf\u5b89\u88c5\u5728\u4e8c\u7ea7\u76ee\u5f55\" width=\"558\" height=\"383\" \/>thinkcmf\u5b89\u88c5\u5728\u4e8c\u7ea7\u76ee\u5f55 blog.yyhcw.com\/chongzhi<\/p>\n<p>\u672c\u5730\u642d\u5efa\u4e00\u5207\u6b63\u5e38\uff0c\u5148\u628aindex.php\u4ecepublic\u76ee\u5f55\u79fb\u52a8\u5230\u4e8c\u7ea7\u76ee\u5f55\u4e0b\uff0c\u4fee\u6539\u90e8\u5206\u53c2\u6570\u6700\u7ec8\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:php decode:true\">\/\/ \u8c03\u8bd5\u6a21\u5f0f\u5f00\u5173\r\ndefine(\"APP_DEBUG\", true);\r\n\r\n\/\/ \u5b9a\u4e49CMF\u6839\u76ee\u5f55,\u53ef\u66f4\u6539\u6b64\u76ee\u5f55\r\ndefine('CMF_ROOT', __DIR__ . '\/');\r\n\r\n\/\/ \u5b9a\u4e49\u5e94\u7528\u76ee\u5f55\r\ndefine('APP_PATH', CMF_ROOT . 'app\/');\r\n\r\n\/\/ \u5b9a\u4e49CMF\u6838\u5fc3\u5305\u76ee\u5f55\r\ndefine('CMF_PATH', CMF_ROOT . 'simplewind\/cmf\/');\r\n\r\n\/\/ \u5b9a\u4e49\u63d2\u4ef6\u76ee\u5f55\r\ndefine('PLUGINS_PATH', __DIR__ . '\/public\/plugins\/');\r\n\r\n\/\/ \u5b9a\u4e49\u6269\u5c55\u76ee\u5f55\r\ndefine('EXTEND_PATH', CMF_ROOT . 'simplewind\/extend\/');\r\ndefine('VENDOR_PATH', CMF_ROOT . 'simplewind\/vendor\/');\r\n\r\n\/\/ \u5b9a\u4e49\u5e94\u7528\u7684\u8fd0\u884c\u65f6\u76ee\u5f55\r\ndefine('RUNTIME_PATH', CMF_ROOT . 'data\/runtime\/');\r\n\r\n\/\/ \u5b9a\u4e49CMF \u7248\u672c\u53f7\r\ndefine('THINKCMF_VERSION', '5.0.180626');\r\n\r\n\/\/ \u52a0\u8f7d\u6846\u67b6\u57fa\u7840\u6587\u4ef6\r\nrequire CMF_ROOT . 'simplewind\/thinkphp\/base.php';\r\n\r\n\/\/ \u6267\u884c\u5e94\u7528\r\n\\think\\App::run()-&gt;send();<\/pre>\n<p>\u597d\u4e86\uff0c\u770b\u770b\u7f51\u7ad9 \u662f\u4e0d\u662f\u53ef\u4ee5\u6b63\u5e38\u8bbf\u95ee\u4e86\uff0c\u4ec0\u4e48\uff1f\u6837\u5f0f\u6ca1\u6709\u52a0\u8f7d\u51fa\u6765\uff1f\u597d\u5427\uff0c\u5fd8\u8bb0\u628apublic\/static\u4e2d\u7684\u3010static\u3011\u76ee\u5f55\u79fb\u52a8\u5230\u4e8c\u7ea7\u76ee\u5f55\u4e0b\u4e86,\u8fd8\u8981\u4fee\u6539config.php\u6587\u4ef6\u4e2d\u7684CMF\u8bbe\u7f6e\u90e8\u5206\uff1a<\/p>\n<pre class=\"lang:php decode:true\">\/\/ +----------------------------------------------------------------------\r\n    \/\/ | CMF \u8bbe\u7f6e\r\n    \/\/ +----------------------------------------------------------------------\r\n    'cmf_theme_path'          =&gt; 'public\/themes\/',\r\n    'cmf_default_theme'       =&gt; 'simpleboot3',\r\n    'cmf_admin_theme_path'    =&gt; 'public\/themes\/',\r\n    'cmf_admin_default_theme' =&gt; 'admin_simpleboot3',<\/pre>\n<p>\u4e3b\u8981\u5c31\u662f\u6a21\u677f\u8def\u5f84\uff1b\uff08\u7531\u4e8e\u662f\u5728\u4e8c\u7ea7\u76ee\u5f55\u4e0b\uff0c\u4e0d\u559c\u6b22\u4ec0\u4e48\u4e1c\u897f\u90fd\u653e\u5230chongzhi\u76ee\u5f55\u4e0b\uff0c\u6240\u4ee5\u624d\u8fd9\u4e48\u6574\uff1b\u5982\u679c\u628a\u6a21\u677f\u76ee\u5f55\u653e\u5230\u548cINDEX.PHP\u540c\u76ee\u5f55\u7684\u8bdd\uff0c\u4e0b\u9762\u7684\u5c31\u4e0d\u7528\u770b\u4e86\uff09\u6700\u7ec8\u6548\u679c\u89c1\u4e0a\u9762\u56fe\u7247\u76ee\u5f55\u7ed3\u6784\u3002<\/p>\n<h2>thinkcmf\u5b89\u88c5\u5728\u4e8c\u7ea7\u76ee\u5f55\u95ee\u9898\u4e4b\u6a21\u677f\u5b89\u88c5<\/h2>\n<p>\u90fd\u53ef\u4ee5\u6b63\u5e38\u8bbf\u95ee\u4e86\uff0c\u4e0b\u9762\u8be5\u4fee\u6539\u6a21\u677f\u4e86\uff0c\u81ea\u5df1\u590d\u5236\u4e00\u4efd\u5b98\u65b9\u6a21\u677f\u5e76\u4e14\u547d\u540d\u4e3a 21863_cn \u5e76\u4e14manifest.json\u6587\u4ef6\u4e2d\u7684name\u6539\u4e3a\u76ee\u5f55\u540d21863_cn,\u4e00\u5207\u5c31\u7eea\uff1b\u540e\u53f0\u5b89\u88c5\u6a21\u677f\uff0c\u5c45\u7136\u4ec0\u4e48\u90fd\u6ca1\u6709.....\u597d\u5427\uff0c\u8fd9\u79cd\u60c5\u51b5\u53ea\u80fd\u67e5\u770b\u6e90\u7801\u6587\u4ef6app\/admin\/controller\/ThemeController.php\uff0c62\u884c\uff1a<\/p>\n<pre class=\"\">public function install()<\/pre>\n<p>\u4e2d\u7684themes \u6539\u4e3a\uff1a<\/p>\n<pre class=\"\">config('cmf_theme_path')<\/pre>\n<p>\u6700\u7ec8\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:php decode:true\">public function install()\r\n    {\r\n        $themesDirs = cmf_scan_dir(config('cmf_theme_path').\"*\", GLOB_ONLYDIR);\r\n        dump($themesDirs);\r\n        $themeModel = new ThemeModel();\r\n\r\n        $themesInstalled = $themeModel-&gt;column('theme');\r\n\r\n        $themesDirs = array_diff($themesDirs, $themesInstalled);\r\n\r\n        $themes = [];\r\n        foreach ($themesDirs as $dir) {\r\n            $manifest = config('cmf_theme_path').$dir.\"\/manifest.json\";\r\n            if (file_exists_case($manifest)) {\r\n                $manifest       = file_get_contents($manifest);\r\n                $theme          = json_decode($manifest, true);\r\n                $theme['theme'] = $dir;\r\n                array_push($themes, $theme);\r\n            }\r\n        }\r\n        $this-&gt;assign('themes', $themes);\r\n\r\n        return $this-&gt;fetch();\r\n    }<\/pre>\n<p>\u6700\u7ec8OK\uff0c\u81f3\u4e8e\u662f\u5426\u5b58\u5728\u5176\u5b83\u95ee\u9898\uff0c\u6682\u4e0d\u786e\u5b9a\uff1b<\/p>\n<p>\u8fd9\u91cc\u4f5c\u8005\u65e2\u7136\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u4e86\u6a21\u677f\u8def\u5f84\uff0c\u4e0d\u77e5\u9053\u4e3a\u4ec0\u4e48\u5728\u5b89\u88c5\u6a21\u677f\u7684\u65f6\u5019\u8fd8\u8981\u53bb\u6839\u76ee\u5f55\u8bfb\u53d6\u5462\uff1f\u540e\u53f0\u3001\u524d\u53f0\u6a21\u677f\u90fd\u6b63\u5e38\uff0c\u8bf4\u660e\u4f5c\u8005\u7528\u7684\u662f\u914d\u7f6e\u4e2d\u7684\u8def\u5f84\uff0c\u53ef\u662f\u4e3a\u4ec0\u4e48\u5728\u5b89\u88c5\u7684\u65f6\u5019\u5374\u53c8\u5c06\u8def\u5f84\u5199\u6b7b\u4e86\uff1f\u662f\u6545\u610f\u4e3a\u4e4b\u8fd8\u662f\u6709\u5176\u5b83\u610f\u601d\u5462\uff1f<\/p>\n<!--wp-compress-html no compression--><!--wp-compress-html-->","protected":false},"excerpt":{"rendered":"\u4e4b\u524d\u5f88\u65e9\u7684\u65f6\u5019\u6709\u4e86\u89e3\u8fc7thinkcmf\uff0c\u4e0d\u8fc7\u5f53\u65f6\u5e76\u6ca1\u6709\u8be6\u7ec6\u4e86\u89e3\u5176\u5177\u4f53\u6d41\u7a0b\uff0c\u8fd9\u4e24\u5929\u60f3\u5728wordpress\u535a\u5ba2\u4e2d\u589e \u00b7\u00b7\u00b7","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[58],"views":761,"_links":{"self":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts\/402"}],"collection":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/comments?post=402"}],"version-history":[{"count":0,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts\/402\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/media?parent=402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/categories?post=402"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/tags?post=402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}