{"id":31418,"date":"2024-11-25T09:11:03","date_gmt":"2024-11-25T01:11:03","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31418\/"},"modified":"2024-11-25T09:11:03","modified_gmt":"2024-11-25T01:11:03","slug":"dedecms%e5%a6%82%e4%bd%95%e6%b7%bb%e5%8a%a0%e5%b9%b6%e5%bc%95%e5%85%a5php%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31418\/","title":{"rendered":"dedecms\u5982\u4f55\u6dfb\u52a0\u5e76\u5f15\u5165php\u6587\u4ef6"},"content":{"rendered":"<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/041\/5e918a4ac6da9826.jpg\" class=\"aligncenter\" title=\"dedecms\u5982\u4f55\u6dfb\u52a0\u5e76\u5f15\u5165php\u6587\u4ef6\u63d2\u56fe\" alt=\"dedecms\u5982\u4f55\u6dfb\u52a0\u5e76\u5f15\u5165php\u6587\u4ef6\u63d2\u56fe\" \/><\/p>\n<p>\u524d\u8a00\uff1a<\/p>\n<p>\u6709\u4e9b\u65f6\u5019\u6211\u4eec\u9700\u8981\u521b\u5efa\u4e00\u4e9b\u5355\u72ec\u7684PHP\u6587\u4ef6\uff0c\u4f46\u662f\u968f\u4fbf\u653e\u5165\u7684PHP\u6587\u4ef6\u662f\u4e0d\u80fd\u591f\u7f16\u8bd1\u7ec7\u68a6 \u7684\u6807\u7b7e\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u5f15\u5165\u7ec7\u68a6\u6807\u7b7e\u7684\u7f16\u8bd1\u5f15\u64ce\u65b9\u6848\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u6211\u4eec\u5728\u6839\u76ee\u5f55\u521b\u5efa example.php\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>&lt;span&gt;&lt;span&gt;&lt;?php     \n    require_once (dirname(__FILE__).\"\/include\/common.inc.php\");    \n    require_once DEDEINC.&#039;\/arc.partview.class.php&#039;;    \n    $tempfile = $cfg_basedir.$cfg_templets_skin.&#039;\/example.htm&#039;;\/\/\u5b9a\u4e49\u6a21\u677f\u8def\u5f84    \n    $pv = new PartView();\/\/\u521d\u59cb\u5316\u7c7b    \n    $pv-&gt;SetTemplet($tempfile);\/\/\u8bbe\u5b9a\u6a21\u677f\u6587\u4ef6\u8def\u5f84&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;$pv-&amp;gt;Display();\/\/\u663e\u793a\u8be5\u9875\u9762&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;?&amp;gt;&lt;\/span&gt;&lt;\/span&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\u628a\u5f53\u524d\u6a21\u677f\u76ee\u5f55\u91cc\uff0c\u521b\u5efa\u4e00\u4e2aexample.htm\u7684\u6a21\u677f\u6587\u4ef6\uff0c\u5728\u8fd9\u4e2a\u6a21\u677f\u6587\u4ef6\u91cc\u5c31\u53ef\u4ee5\u4f7f\u7528\u7ec7\u68a6\u7cfb\u7edf\u7684\u5168\u5c40\u6807\u7b7e\u4e86\u3002<\/p>\n<p>\u6211\u4eec\u6765\u505a\u4e00\u4e2a\u5206\u6790\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>require_once&nbsp;(dirname(__FILE__).\"\/include\/common.inc.php\");<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u8fd9\u4e2a\u5730\u65b9\uff0c\u5176\u5b9e\u5c31\u662f\u5f15\u5165\u4e86include\u6587\u4ef6\u5939\u4e0b\u9762\u7684\u7ec7\u68a6\u6570\u636e\u5e93\u914d\u7f6e\u6587\u4ef6(\u6216\u8005\u88ab\u79f0\u547c\u4e3a\uff1a\u6838\u5fc3\u51fd\u6570\u914d\u7f6e\u6587\u4ef6)common.inc.php\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528require_once()\u8bed\u53e5\u4e3b\u8981\u7528\u4e8e\u9700\u8981\u5305\u542b\u591a\u4e2a\u6587\u4ef6\u65f6\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u907f\u514d\u628a\u540c\u4e00\u6bb5\u4ee3\u7801\u5305\u542b\u8fdb\u53bb\u800c\u51fa\u73b0\u51fd\u6570\u6216\u53d8\u91cf\u91cd\u590d\u5b9a\u4e49\u7684\u9519\u8bef\u3002<\/p>\n<p>\u5176\u4e2d\u7684dirname(__FILE__)\u662f\u53d6\u5f97\u8c03\u7528PHP\u6587\u4ef6\u7684\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u5927\u5bb6\u90fd\u77e5\u9053\uff0c\u542f\u7528\u7edd\u5bf9\u8def\u5f84\u7f16\u8bd1\u7684\u901f\u5ea6\u4f1a\u6bd4\u76f8\u5bf9\u8def\u5f84\u8981\u5feb\u3002\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u5c06\u4e0a\u9762\u7684\u4ee3\u7801\u603b\u7ed3\u4e3a\uff1a\u5f15\u5165\u4e00\u4e2a\u6839\u76ee\u5f55include\u6587\u4ef6\u5939\u91cc\u9762\u7684common.inc.php\u6587\u4ef6\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff1a<\/p>\n<pre>require_once&nbsp;DEDEINC.'\/arc.partview.class.php';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee3\u7801\u662f\u540c\u6837\u7684\u9053\u7406\uff1a\u53ef\u4ee5\u7406\u89e3\u4e3a\u5f15\u5165include<\/p>\n<p>\u63a8\u8350\u6559\u7a0b\uff1a<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u6dfb\u52a0\u5e76\u5f15\u5165php\u6587\u4ef6\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00\uff1a \u6709\u4e9b\u65f6\u5019\u6211\u4eec\u9700\u8981\u521b\u5efa\u4e00\u4e9b\u5355\u72ec\u7684PHP\u6587\u4ef6\uff0c\u4f46\u662f\u968f\u4fbf\u653e\u5165\u7684PHP\u6587\u4ef6\u662f\u4e0d\u80fd\u591f\u7f16\u8bd1\u7ec7\u68a6 \u7684\u6807\u7b7e\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u5f15\u5165\u7ec7\u68a6\u6807\u7b7e\u7684\u7f16\u8bd1\u5f15\u64ce\u65b9\u6848\u3002 \u4f8b\u5982\uff0c\u6211\u4eec\u5728\u6839\u76ee\u5f55\u521b\u5efa example.php\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a &lt;span&gt;&lt;span&gt;&lt;?php require_once (dirname(__FILE__).&#8221;\/include\/common.inc.php&#8221;); require_once DEDEINC.&#039;\/arc.partview.class.php&#039;; $tempfile = $cfg_basedir.$cfg_templets_skin.&#039;\/example.htm&#039;;\/\/\u5b9a\u4e49\u6a21\u677f\u8def\u5f84 $pv = new PartView();\/\/\u521d\u59cb\u5316\u7c7b $pv-&gt;SetTemplet($tempfile);\/\/\u8bbe\u5b9a\u6a21\u677f\u6587\u4ef6\u8def\u5f84&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;$pv-&amp;gt;Display();\/\/\u663e\u793a\u8be5\u9875\u9762&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;?&amp;gt;&lt;\/span&gt;&lt;\/span&gt; \u767b\u5f55\u540e\u590d\u5236 \u7136\u540e\u628a\u5f53\u524d\u6a21\u677f\u76ee\u5f55\u91cc\uff0c\u521b\u5efa\u4e00\u4e2aexample.htm\u7684\u6a21\u677f\u6587\u4ef6\uff0c\u5728\u8fd9\u4e2a\u6a21\u677f\u6587\u4ef6\u91cc\u5c31\u53ef\u4ee5\u4f7f\u7528\u7ec7\u68a6\u7cfb\u7edf\u7684\u5168\u5c40\u6807\u7b7e\u4e86\u3002 \u6211\u4eec\u6765\u505a\u4e00\u4e2a\u5206\u6790\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b require_once&nbsp;(dirname(__FILE__).&#8221;\/include\/common.inc.php&#8221;); \u767b\u5f55\u540e\u590d\u5236 \u5728\u8fd9\u4e2a\u5730\u65b9\uff0c\u5176\u5b9e\u5c31\u662f\u5f15\u5165\u4e86include\u6587\u4ef6\u5939\u4e0b\u9762\u7684\u7ec7\u68a6\u6570\u636e\u5e93\u914d\u7f6e\u6587\u4ef6(\u6216\u8005\u88ab\u79f0\u547c\u4e3a\uff1a\u6838\u5fc3\u51fd\u6570\u914d\u7f6e\u6587\u4ef6)common.inc.php\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528require_once()\u8bed\u53e5\u4e3b\u8981\u7528\u4e8e\u9700\u8981\u5305\u542b\u591a\u4e2a\u6587\u4ef6\u65f6\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u907f\u514d\u628a\u540c\u4e00\u6bb5\u4ee3\u7801\u5305\u542b\u8fdb\u53bb\u800c\u51fa\u73b0\u51fd\u6570\u6216\u53d8\u91cf\u91cd\u590d\u5b9a\u4e49\u7684\u9519\u8bef\u3002 \u5176\u4e2d\u7684dirname(__FILE__)\u662f\u53d6\u5f97\u8c03\u7528PHP\u6587\u4ef6\u7684\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u5927\u5bb6\u90fd\u77e5\u9053\uff0c\u542f\u7528\u7edd\u5bf9\u8def\u5f84\u7f16\u8bd1\u7684\u901f\u5ea6\u4f1a\u6bd4\u76f8\u5bf9\u8def\u5f84\u8981\u5feb\u3002\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u5c06\u4e0a\u9762\u7684\u4ee3\u7801\u603b\u7ed3\u4e3a\uff1a\u5f15\u5165\u4e00\u4e2a\u6839\u76ee\u5f55include\u6587\u4ef6\u5939\u91cc\u9762\u7684common.inc.php\u6587\u4ef6\u3002 \u63a5\u4e0b\u6765\uff1a require_once&nbsp;DEDEINC.&#8217;\/arc.partview.class.php&#8217;; \u767b\u5f55\u540e\u590d\u5236 \u4ee3\u7801\u662f\u540c\u6837\u7684\u9053\u7406\uff1a\u53ef\u4ee5\u7406\u89e3\u4e3a\u5f15\u5165include \u63a8\u8350\u6559\u7a0b\uff1a \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u6dfb\u52a0\u5e76\u5f15\u5165php\u6587\u4ef6\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-31418","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=31418"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31418\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}