{"id":125,"date":"2010-11-28T01:07:10","date_gmt":"2010-11-28T01:07:10","guid":{"rendered":"http:\/\/blog.yyhcw.com\/post\/125.html"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T07:54:17","slug":"include","status":"publish","type":"post","link":"http:\/\/blog.yyhcw.com\/post\/125.html","title":{"rendered":"asp\u6a21\u677f\u4e5f\u4f7f\u7528include(&#8220;\u6587\u4ef6\u540d.html&#8221;)\u7c7b\u4f3c\u4e8e{dede:include filename=&#8221;\u6587\u4ef6\u540d.htm&#8221;\/}"},"content":{"rendered":"<p>&nbsp;\u3000\u3000\u4e00\u76f4\u5f88\u559c\u6b22DEDE\u7684\u90a3\u4e2a\u6a21\u677f\u4e2d\u6587\u4ef6\u8f7d\u5165\u7684\u529f\u80fd\uff0c\u82e6\u4e8e\u672c\u4ebaPHP\u4e0d\u7cbe\u901a\uff0c\u53ea\u597d\u4f7f\u7528ASP\u6765\u5b8c\u6210\u6b64\u5de5\u4f5c\u4e86\uff01\u7ecf\u8fc7\u518d\u4e0b\u4e0d\u5c51\u52aa\u529b\uff0c\u7ec8\u4e8e\u5b9e\u73b0\u4e86\u50cfdede\u6a21\u677f\u90a3\u6837\u53ef\u4ee5include\u6587\u4ef6\u8fdb\u6765\uff0c\u5e76\u89e3\u6790\u4e86\uff01<\/p>\n<p>\u3000\u3000\u4e0d\u77e5\u9053\u4e3a\u4ec0\u4e48\uff0c\u627e\u4e86\u597d\u591aASP\u4f01\u4e1a\u7ad9\uff0c\u4ec0\u4e48\u6837\u5f0f\u7684\u90fd\u6d4b\u8bd5\u4e86\uff0c\u6ca1\u6709\u4e00\u4e2a\u5b9e\u73b0\u6b64\u529f\u80fd\u7684\uff0c\u4e5f\u4e0d\u77e5\u9053\u662f\u6211\u627e\u7684\u5c11\u4e86\u8fd8\u662f\u6211\u6ca1\u6709\u627e\u5230....\u6bd4\u8f83\u7ea0\u7ed3\u3002<\/p>\n<p>\u3000\u3000\u4e0d\u591a\u8bf4\u4e86\uff0c\u9a6c\u4e0a\u4e0b\u73ed\u4e86\uff0c\u9644\u4e0a\u4ee3\u7801\u5982\u4e0b\uff0c\u6b22\u8fce\u670b\u53cb\u4eec\u7559\u610f\u4ea4\u6d41\uff1a<\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \">'\/\/\u79c1\u6709\u529e\u6cd5----\u5faa\u73af\u5d4c\u5957include(\u4ece\u4ee3\u7801\u89e3\u6790,\u6587\u4ef6\u540d)<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \">Private Function LoadInclude(ByVal html,ByVal fromPath)<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span>Dim incpath<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span>Dim Match,Matches<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span>'include\u4f18\u5148<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span> &nbsp;EX.Pattern = &quot;{include\\(['&quot;&quot;]*(.+?)['&quot;&quot;]*\\)}&quot;<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span>Set Matches = EX.Execute(html) '\u6267\u884c\u641c\u7d22\u3002<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span>For Each Match in Matches<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span> &nbsp;incpath = Replace(strSITEROOT &amp; strTemplate_dir &amp; Match.SubMatches(0),&quot;\/&quot;,&quot;\\&quot;)<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span> &nbsp;If Lcase(fromPath)&lt;&gt;Lcase(incpath) Then<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span> &nbsp;<span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span>'*******<\/span>incpath\u6587\u4ef6\u8be6\u7ec6\u8def\u5f84*******<\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span> &nbsp;<span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span>html = Replace(html,Match.value,LoadInclude(LoadFile(incpath),incpath))&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;'<\/span>LoadFile \u8f7d\u5165\u6587\u4ef6\u7528\u7684<\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span> &nbsp;Else<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span> &nbsp;<span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span>html = Replace(html,Match.value,&quot;&quot;)<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span> &nbsp;End If<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span>Next<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span>Set Matches = Nothing<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \"><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t<\/span>LoadInclude = html<\/span><\/p>\n<p><span style=\"background-color: rgb(255, 255, 204); \">End Function<\/span><\/p>\n<p>\u8fd9\u4e2a\u4e3b\u8981\u662f\u8f7d\u5165 include\u6587\u4ef6\u7684 \u4f60\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u8fdb\u884c\u4fee\u6539 \u6216\u662f\u6539\u6210\u50cfDEDE\u90a3\u6837\u7684\u4e5f\u53ef\u4ee5\u554a\uff01 \u6a21\u677f\u6587\u4ef6\u4e2d\u4f7f\u7528&nbsp;{include(&quot;head.html&quot;)} &nbsp;\u5f62\u5f0f\u8c03\u7528\uff01<\/p>\n<p>\u6b22\u8fce\u5927\u5bb6\u7559\u610f\u4ea4\u6d41\uff01<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"&nbsp;\u3000\u3000\u4e00\u76f4\u5f88\u559c\u6b22DEDE\u7684\u90a3\u4e2a\u6a21\u677f\u4e2d\u6587\u4ef6\u8f7d\u5165\u7684\u529f\u80fd\uff0c\u82e6\u4e8e\u672c\u4ebaPHP\u4e0d\u7cbe\u901a\uff0c\u53ea\u597d\u4f7f\u7528ASP\u6765\u5b8c\u6210\u6b64\u5de5\u4f5c \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":[],"views":261,"_links":{"self":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts\/125"}],"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=125"}],"version-history":[{"count":0,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/posts\/125\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/media?parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/categories?post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.yyhcw.com\/api\/wp\/v2\/tags?post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}