{"id":73,"date":"2023-06-05T12:45:30","date_gmt":"2023-06-05T04:45:30","guid":{"rendered":"http:\/\/pro369.com\/php\/?p=73"},"modified":"2019-04-12T13:33:27","modified_gmt":"2019-04-12T13:33:27","slug":"%e4%bb%80%e9%ba%bc%e6%98%af%e7%af%84%e6%9c%ac%ef%bc%8c%e6%80%8e%e9%ba%bc%e4%bd%bf%e7%94%a8%e7%af%84%e6%9c%ac%e5%91%a2%ef%bc%9f%ef%bc%88php%e7%a8%8b%e5%bc%8f%e8%a8%ad%e8%a8%88%e5%95%8f%e9%a1%8c%e8%888","status":"publish","type":"post","link":"https:\/\/por.tw\/php\/%e4%bb%80%e9%ba%bc%e6%98%af%e7%af%84%e6%9c%ac%ef%bc%8c%e6%80%8e%e9%ba%bc%e4%bd%bf%e7%94%a8%e7%af%84%e6%9c%ac%e5%91%a2%ef%bc%9f%ef%bc%88php%e7%a8%8b%e5%bc%8f%e8%a8%ad%e8%a8%88%e5%95%8f%e9%a1%8c%e8%888\/","title":{"rendered":"\u4ec0\u9ebc\u662f\u7bc4\u672c\uff0c\u600e\u9ebc\u4f7f\u7528\u7bc4\u672c\u5462\uff1f\uff08PHP\u7a0b\u5f0f\u8a2d\u8a08\u554f\u984c\u8207\u7b54\u8986\uff09"},"content":{"rendered":"<p><font size=\"3\" color=\"#008000\"><strong>PHP\u7a0b\u5f0f\u8a2d\u8a08\u554f\u984c\u8aee\u8a62\uff1a<br \/> \u8acb\u554f\uff0c\u4ec0\u9ebc\u662f\u7bc4\u672c\uff0c\u600e\u9ebc\u4f7f\u7528\u7bc4\u672c\u5462\uff1f<\/strong><\/font><br \/> &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/> <font size=\"3\" color=\"#FF0000\"><strong>PHP\u7a0b\u5f0f\u8a2d\u8a08\u554f\u984c\u56de\u8986\uff1a<br \/> <font color=\"#0000FF\">\u4ec0\u9ebc\u662f\u7bc4\u672c\uff0c\u600e\u9ebc\u4f7f\u7528\u7bc4\u672c\u5462\uff1f\uff0c\u53ef\u4ee5\u53c3\u8003\u4ee5\u4e0b\u7684\u8aaa\u660e\uff1a<\/font><\/strong><\/font><br \/> &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/> <strong><font color=\"#800080\">\u4ec0\u9ebc\u662f\u7bc4\u672c\uff0c\u600e\u9ebc\u4f7f\u7528\u7bc4\u672c\u5462\uff1f<\/font><br \/> <font color=\"#800000\">\u9019\u88cf\u6709\u5e7e\u7bc7\u95dc\u65bc\u7bc4\u672c\u7684\u6587\u7ae0<\/font><br \/> <font color=\"#008080\">\u7528\u7684\u662fphplib\u7bc4\u672c<br \/> \u4e0b\u9762\u662f\u5176\u4e2d\u5e7e\u500b\u51fd\u6578\u7684\u4f7f\u7528<\/font><\/strong><\/p>\n<p> $T-&gt;Set_File(&quot;\u96a8\u4fbf\u5b9a\u7fa9&quot;,&quot;\u7bc4\u672c\u6a94.tpl&quot;);<\/p>\n<p> $T-&gt;Set_Block(&quot;\u5728set_file\u4e2d\u5b9a\u7fa9\u7684&quot;,&quot;&lt;!&#8211; \u4f86\u81ea\u7bc4\u672c &#8211;&gt;&quot;,&quot;\u96a8\u4fbf\u5b9a\u7fa9&quot;);<\/p>\n<p> $T-&gt;Parse(&quot;\u5728Set_Block\u4e2d\u5b9a\u7fa9\u7684&quot;,&quot;&lt;!&#8211; \u4f86\u81ea\u7bc4\u672c &#8211;&gt;&quot;,true);<\/p>\n<p> $T-&gt;Parse(&quot;\u96a8\u4fbf\u8f38\u51fa\u7d50\u679c&quot;,&quot;\u5728Set_File\u4e2d\u5b9a\u7fa9\u7684&quot;);<\/p>\n<p> \u8a2d\u7f6e\u8ff4\u5708\u683c\u5f0f\u70ba:<\/p>\n<p> &lt;!&#8211;(\u591a\u65bc\u4e00\u500b\u7a7a\u683c) BEGIN $handle(\u591a\u65bc\u4e00\u500b\u7a7a\u683c)&#8211;&gt;<\/p>\n<p> \u5982\u4f55\u5c07\u7bc4\u672c\u751f\u6210\u975c\u614b\u7db2\u9801<br \/> &lt;?php<br \/> \/\/\u9019\u88cf\u4f7f\u7528phplib\u7bc4\u672c<br \/> &nbsp;&nbsp;&nbsp; &#8230;&#8230;&#8230;&#8230;<br \/> &nbsp;&nbsp;&nbsp; &#8230;&#8230;&#8230;&#8230;<br \/> &nbsp;&nbsp;&nbsp; $tpl-&gt;parse(&quot;output&quot;,&quot;html&quot;);<br \/> &nbsp;&nbsp;&nbsp; $output = $tpl-&gt;get(&quot;output&quot;);\/\/ $output \u70ba\u6574\u500b\u7db2\u9801\u5167\u5bb9<\/p>\n<p> &nbsp;&nbsp;&nbsp; function wfile($file,$content,$mode=&#39;w&#39;) {<br \/> &nbsp;&nbsp;&nbsp; $oldmask = umask(0);<br \/> &nbsp;&nbsp;&nbsp; $fp = fopen($file, $mode);<br \/> &nbsp;&nbsp;&nbsp; if (!$fp) return false;<br \/> &nbsp;&nbsp;&nbsp; fwrite($fp,$content);<br \/> &nbsp;&nbsp;&nbsp; fclose($fp);<br \/> &nbsp;&nbsp;&nbsp; umask($oldmask);<br \/> &nbsp;&nbsp;&nbsp; return true;<br \/> }<br \/> &nbsp;&nbsp; \/\/ \u5beb\u5230\u6587\u4ef6\u88cf<br \/> &nbsp;&nbsp;&nbsp; Wfile($FILE,$output);<br \/> &nbsp;&nbsp;&nbsp; header(&quot;location:$FILE&quot;);\/\/\u91cd\u5b9a\u5411\u5230\u751f\u6210\u7684\u7db2\u9801<br \/> }<br \/> ?&gt;&nbsp;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u7a0b\u5f0f\u8a2d\u8a08\u554f\u984c\u8aee\u8a62\uff1a \u8acb\u554f\uff0c\u4ec0\u9ebc\u662f\u7bc4\u672c\uff0c\u600e\u9ebc\u4f7f\u7528\u7bc4\u672c\u5462\uff1f &#8212;&#8212;&#8212;&#038;#8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":402,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[22],"class_list":["post-73","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-php"],"_links":{"self":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts\/73"}],"collection":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/comments?post=73"}],"version-history":[{"count":0,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts\/73\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/media\/402"}],"wp:attachment":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/media?parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/categories?post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/tags?post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}