{"id":83,"date":"2009-04-10T23:07:57","date_gmt":"2009-04-11T03:07:57","guid":{"rendered":"http:\/\/www.prglab.com\/blog\/?p=83"},"modified":"2009-08-29T20:36:48","modified_gmt":"2009-08-30T00:36:48","slug":"%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%ab%af%e5%8c%85%e5%90%abssiserver-side-include%e7%ae%80%e4%bb%8b","status":"publish","type":"post","link":"https:\/\/www.prglab.com\/blog\/p\/83","title":{"rendered":"\u670d\u52a1\u5668\u7aef\u5305\u542bSSI(Server Side Include)\u7b80\u4ecb"},"content":{"rendered":"<p class=\"margin\">\u670d\u52a1\u5668\u7aef\u5305\u542b SSI\uff0c\u662f\u82f1\u6587 Server Side Includes\u7684\u7b80\u5199\u3002SSI\u662f\u4e00\u79cd\u53ef\u4ee5\u6307\u6325\u670d\u52a1\u5668\u52a8\u6001\u58f0\u79f0\u7f51\u9875\u5185\u5bb9\u7684HTML\u6307\u4ee4\u3002<\/p>\n<p class=\"margin\">\u901a\u5e38SSI\u53ef\u4ee5\u7528\u6765\u786e\u4fdd\u7f51\u9875\u4e2d\u7684\u4e00\u4e9b\u901a\u7528\u5185\u5bb9\uff0c\u6bd4\u5982\u7248\u6743\u4fe1\u606f\u3001\u8054\u7cfb\u65b9\u5f0f\u3001\u6216\u5bfc\u822a\u4fe1\u606f\u5728\u5168\u7ad9\u6240\u6709\u7f51\u9875\u4e2d\u4fdd\u6301\u4e00\u81f4\u3002\u4f7f\u7528SSI\u663e\u793a\u8fd9\u4e9b\u901a\u7528\u5185\u5bb9\u8fd8\u53ef\u4ee5\u51cf\u8f7b\u7f51\u7ad9\u7ef4\u62a4\u7684\u5de5\u4f5c\u91cf\uff0c\u56e0\u4e3a\u5f53\u9700\u8981\u4fee\u6539\u8fd9\u4e9b\u901a\u7528\u4fe1\u606f\u7684\u65f6\u5019\uff0c\u53ea\u9700\u8981\u6539\u4e00\u4e2a\u5730\u65b9\u5c31\u53ef\u4ee5\u4e86\uff0c\u800c\u4e0d\u9700\u8981\u9010\u4e2a\u4fee\u6539\u6bcf\u4e00\u4e2a\u7f51\u9875\u3002<\/p>\n<p class=\"margin\">\u5404\u4e2a\u670d\u52a1\u5668\u5bf9SSI\u547d\u4ee4\u7684\u652f\u6301\u5404\u6709\u4e0d\u540c\uff0c\u4f46 #include \u548c #exec \u662f\u901a\u7528\u7684\u3002\u4f7f\u7528 SSI \u7684\u9875\u9762\u6587\u4ef6\u901a\u5e38\u90fd\u4f7f\u7528\u6269\u5c55\u540d.shtml\uff0c\u800c\u4e0d\u662f.html \u6216 .htm\uff0c\u8fd9\u6837\u4ee5\u4fbf\u670d\u52a1\u5668\u80fd\u591f\u8fa8\u8ba4\u51fa\u54ea\u4e9b\u9875\u9762\u5305\u542bSSI\u6307\u4ee4\uff0c\u8fd9\u4e9b\u9875\u9762\u9700\u8981\u5148\u7ecf\u8fc7\u670d\u52a1\u5668\u5904\u7406\uff0c\u7ffb\u8bd1\u6267\u884c\u5176\u4e2d\u7684SSI\u6307\u4ee4\uff0c\u7136\u540e\u624d\u53d1\u9001\u7ed9\u5ba2\u6237\u7aef\u6d4f\u89c8\u5668\u3002\u00a0 (\u5f53\u7136\u6709\u4e9b\u670d\u52a1\u5668\u8fd8\u662f\u652f\u6301.html,.htm\u6587\u4ef6\u4e2d\u6709SSI\u6307\u4ee4\u7684)\u3002<\/p>\n<p class=\"margin\"><!--more--><\/p>\n<p class=\"margin\">\n<p><strong>\u5982\u4f55\u8fa8\u522b\u4f60\u7684\u670d\u52a1\u5668\u662f\u5426\u652f\u6301 SSI?<\/strong><\/p>\n<p class=\"margin\">\u591a\u6570\u7f51\u7ad9\u5bc4\u5b58\u670d\u52a1\u90fd\u652f\u6301 SSI &#8211; \u4f46\u662f\u4e5f\u6709\u4e00\u4e9b\u4e0d\u652f\u6301\uff0c\u7279\u522b\u662f\u4e00\u4e9b\u514d\u8d39\u7684\u7f51\u7ad9\u5bc4\u5b58\u670d\u52a1\u3002\u4f60\u53ef\u4ee5\u8054\u7cfb\u4f60\u7684\u7f51\u7ad9\u5bc4\u5b58\u516c\u53f8\u8be2\u95ee\u4ed6\u4eec\u662f\u5426\u652f\u6301SSI\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u6765\u81ea\u5df1\u6d4b\u8bd5\u4e00\u4e0b\u4f60\u7684\u670d\u52a1\u5668\u662f\u5426\u652f\u6301SSI:<\/p>\n<p>1. \u62f7\u8d1d\u4ee5\u4e0bHTML\u5185\u5bb9\uff0c\u4fdd\u5b58\u4e3a\u6587\u4ef6\u540dtest.shtml<\/p>\n<p><strong><span style=\"color: #ff6633;\">&lt;html&gt;&lt;head&gt;&lt;\/head&gt;<\/span><\/strong><\/p>\n<p><strong><span style=\"color: #ff6633;\">&lt;body&gt;&lt;!&#8211;#echo var=&#8221;DATE_LOCAL&#8221; &#8211;&gt;&lt;\/body&gt;<\/span><\/strong><\/p>\n<p><strong><span style=\"color: #ff6633;\">&lt;\/html&gt;<br \/>\n<\/span><\/strong><\/p>\n<p class=\"margin\">2. \u5c06\u8fd9\u4e2a\u6587\u4ef6\u4e0a\u8f7d\u5230\u4f60\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u7136\u540e\u7528\u6d4f\u89c8\u5668\u6d4f\u89c8\u670d\u52a1\u5668\u4e0a\u7684\u8fd9\u4e2a\u7f51\u9875\u3002<\/p>\n<p>3. \u5982\u679c\u770b\u5230\u7f51\u9875\u663e\u793a\u5f53\u524d\u65e5\u671f\uff0c\u5219\u4f60\u7684\u670d\u52a1\u5668\u652f\u6301 SSI\u3002\u5426\u5219\uff0c\u591a\u534a\u53ef\u80fd\u4f60\u7684\u670d\u52a1\u5668\u4e0d\u652f\u6301SSI\u3002\u4f60\u53ef\u4ee5\u5c1d\u8bd5\u4e0e\u4f60\u7684\u7f51\u7ad9\u5bc4\u5b58\u516c\u53f8\u8054\u7cfb\u770b\u4ed6\u4eec\u662f\u5426\u53ef\u4ee5\u4e3a\u4f60\u5f00\u901aSSI\u670d\u52a1\u3002<\/p>\n<p class=\"margin\"><strong>\u7ec3\u4e601: \u663e\u793a\u7248\u6743\u4fe1\u606f<\/strong><\/p>\n<p class=\"margin\">1. \u62f7\u8d1d\u4ee5\u4e0b\u5185\u5bb9\u5e76\u5b58\u4e3acopyright.html\u6587\u4ef6\u540d \uff08\u4f60\u53ef\u4ee5\u628a\u94fe\u63a5\u548c\u7f51\u7ad9\u540d\u79f0\u4fee\u6539\u4e3a\u4f60\u7684\u7f51\u7ad9\uff09\uff1a<\/p>\n<blockquote>\n<p class=\"margin\"><strong><span style=\"color: #ff6600;\">&amp;copy;2007 &lt;a href=&#8221;http:\/\/www.prglab.com&#8221;&gt; \u7a0b\u5e8f\u5458\u5b9e\u9a8c\u5ba4&lt;\/a&gt; \u7248\u6743\u6240\u6709\u3002 <\/span><\/strong><\/p>\n<\/blockquote>\n<p class=\"margin\" style=\"padding-left: 30px;\">\u5728\u6d4f\u89c8\u5668\u4e2d\u5b83\u5e94\u8be5\u663e\u793a\u4e3a<\/p>\n<blockquote>\n<p class=\"margin\"><strong><span style=\"color: #6699cc;\">\u00a92007 <a href=\"http:\/\/www.prglab.com\">\u7a0b\u5e8f\u5458\u5b9e\u9a8c\u5ba4<\/a> \u7248\u6743\u6240\u6709\u3002<br \/>\n<\/span><\/strong><\/p><\/blockquote>\n<p class=\"margin\" style=\"padding-left: 30px;\"><strong>\u6ce8\u610f\uff1a<\/strong>\u5728\u8fd9\u4e2a\u6587\u4ef6\u4ee3\u7801\u4e2d\u4e0d\u80fd\u591f\u51fa\u73b0 &lt;html&gt;, &lt;head&gt; \u548c &lt;body&gt; \u8fd9\u4e9b\u6807\u7b7e\uff0c\u5426\u5219\u5305\u542b\u5b83\u7684\u9875\u9762\u4f1a\u51fa\u9519\u3002<\/p>\n<p class=\"margin\">2. \u5c06\u8fd9\u4e2a\u6587\u4ef6copyright.html\u4e0a\u4f20\u5230\u4f60\u7684\u670d\u52a1\u5668\u4e0a\u3002<\/p>\n<p class=\"margin\">3. \u5728\u8981\u663e\u793a\u7248\u6743\u4fe1\u606f\u7684\u9875\u9762\u5e95\u90e8&lt;\/body&gt;\u6807\u7b7e\u4e4b\u524d\u63d2\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<br \/>\n<strong> <\/strong><\/p>\n<blockquote>\n<p class=\"margin\"><strong><span style=\"color: #ff6600;\">&lt;!&#8211;#include virtual=&#8221;\/copyright.html&#8221;                          &#8211;&gt;<\/span><\/strong><\/p>\n<\/blockquote>\n<p class=\"margin\">4.\u5c06\u4fee\u6539\u540e\u7684\u6587\u4ef6\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u7136\u540e\u7528\u6d4f\u89c8\u5668\u6253\u5f00\u670d\u52a1\u5668\u4e0a\u7684\u6587\u4ef6\uff0c\u4f60\u5e94\u8be5\u770b\u5230\u9875\u9762\u7684\u5e95\u90e8\u663e\u793a\u7248\u6743\u4fe1\u606f\u3002<\/p>\n<p class=\"margin\" style=\"padding-left: 30px;\"><strong>\u6ce8\u610f\uff1a<\/strong> \u5199\u6709\u5305\u542b\u6307\u4ee4(#include)\u4ee3\u7801\u7684\u6587\u4ef6\u53ef\u80fd\u8981\u4fdd\u5b58\u4e3a\u6269\u5c55\u540d\u4e3a.shtml\u7684\u6587\u4ef6\u540d\uff0c\u4ee3\u7801\u624d\u80fd\u751f\u6548\u3002<\/p>\n<p class=\"margin\">\n<p class=\"margin\"><strong>\u7ec3\u4e60 2: \u7b80\u5355\u7684\u5bfc\u822a\u6761<\/strong><\/p>\n<p class=\"margin\">1. \u6bd4\u5982\u6211\u4eec\u8981\u5199\u4e00\u4e2a\u5982\u4e0b\u6240\u793a\u7684\u5bfc\u822a\u6761<br \/>\n<strong> <\/strong><\/p>\n<p class=\"margin\" style=\"padding-left: 30px;\"><strong>\u4e3b\u9875| \u8054\u7cfb\u65b9\u5f0f | \u4ea7\u54c1\u4ecb\u7ecd | \u8ba2\u5355<br \/>\n<\/strong><\/p>\n<p class=\"margin\" style=\"padding-left: 30px;\">\u53ef\u4ee5\u7528\u4ee5\u4e0bHTML\u4ee3\u7801\u6765\u5b9e\u73b0\uff1a<\/p>\n<blockquote>\n<p class=\"margin\"><strong><span style=\"color: #ff6600;\">&lt;p align=&#8221;center&#8221;&gt;&lt;font                            face=&#8221;Geneva, Arial, Helvetica, sans-serif&#8221;                            size=&#8221;2&#8243;&gt;<\/span><\/strong><\/p>\n<p class=\"margin\"><strong><span style=\"color: #ff6600;\">&lt;a href=&#8221;home.htm&#8221;&gt;\u4e3b\u9875&lt;\/a&gt;<\/span><\/strong><\/p>\n<p class=\"margin\"><strong><span style=\"color: #ff6600;\">| &lt;a href=&#8221;mailto:myemail@address.com&#8221;&gt;\u8054\u7cfb\u65b9\u5f0f&lt;\/a&gt;<\/span><\/strong><\/p>\n<p class=\"margin\"><strong><span style=\"color: #ff6600;\"> | &lt;a href=&#8221;\uff50\uff52\uff4f\uff44\uff55\uff43\uff54\uff53.htm&#8221;&gt;\u4ea7\u54c1\u4ecb\u7ecd<\/span><\/strong><strong><span style=\"color: #ff6600;\">&lt;\/a&gt;<\/span><\/strong><\/p>\n<p class=\"margin\"><strong><span style=\"color: #ff6600;\">| &lt;a href=&#8221;orders.htm&#8221;&gt;\u8ba2\u5355&lt;\/a&gt;&lt;\/font&gt;&lt;\/p&gt;<\/span><\/strong><\/p>\n<\/blockquote>\n<p class=\"margin\"><span style=\"color: #6699cc;\"><strong> <\/strong><\/span><\/p>\n<p class=\"margin\">\uff12.\u3000\u4fdd\u5b58\u8fd9\u4e9b\u4ee3\u7801\u4e3a\u6587\u4ef6 navigation.shtml \u6216 navigation.shtm.<\/p>\n<p class=\"margin\">\uff13.\u3000\u6253\u5f00\u8981\u63d2\u5165\u5bfc\u822a\u6761\u7684\u9875\u9762\uff0c\u5728\u8981\u663e\u793a\u5bfc\u822a\u6761\u7684\u4f4d\u7f6e\u63d2\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<blockquote>\n<p class=\"margin\"><strong><span style=\"color: #ff6600;\">&lt;!&#8211;#include virtual=&#8221;\/navigation.shtml&#8221;                          &#8211;&gt;<\/span><\/strong><\/p>\n<\/blockquote>\n<p class=\"margin\">\uff14.\u3000\u5c06\u6240\u6709\u6587\u4ef6\u4e0a\u8f7d\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u5e76\u7528\u6d4f\u89c8\u5668\u68c0\u67e5\u5bfc\u822a\u6761\u662f\u5426\u5982\u4f60\u6240\u8bbe\u60f3\u7684\u663e\u793a\u3002<\/p>\n<p class=\"margin\">\u4ee5\u4e0a\u53ea\u662f\u4e24\u4e2a\u5f88\u7b80\u5355\u7684SSI\u4f7f\u7528\u7684\u4f8b\u5b50\uff0c\u4f60\u8fd8\u53ef\u4ee5\u81ea\u7531\u53d1\u6325\u5199\u51fa\u66f4\u590d\u6742\u7684\u7f51\u9875\u3002\u5982\u679c\u9700\u8981\u4fee\u6539SSI\u5305\u542b\u7684\u5185\u5bb9\uff0c\u53ea\u9700\u8981\u6253\u5f00\u5199\u6709\u901a\u7528\u5185\u5bb9\u7684\u7f51\u9875\uff0c\u6bd4\u5982\u4e0a\u9762\u7684copyright.html\u6216navigation.shtml\uff0c\u4fee\u6539\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u90a3\u4e48\u6240\u6709\u5305\u542b\u8fd9\u4e2a\u6587\u4ef6\u7684\u7f51\u9875\u76f8\u5e94\u5185\u5bb9\u90fd\u4f1a\u88ab\u81ea\u52a8\u4fee\u6539\u3002<\/p>\n<p class=\"margin\">SSI \u76f8\u5bf9\u6765\u8bf4\u6bd4\u8f83\u5bb9\u6613\u638c\u63e1\uff0c\u5e76\u80fd\u63d0\u9ad8\u7f51\u7ad9\u7ef4\u62a4\u6548\u7387\uff0c\u4e0d\u59a8\u4e00\u8bd5\u3002<\/p>\n<p class=\"margin\">\u53c2\u8003\u6587\u7ae0\uff1a <a href=\"http:\/\/www.thetemplatestore.com\/tutorials\/ssi.asp\" target=\"_blank\">Server Side Includes Tutorial (From The Template Store)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u670d\u52a1\u5668\u7aef\u5305\u542b SSI\uff0c\u662f\u82f1\u6587 Server Side Includes\u7684\u7b80\u5199\u3002SSI\u662f\u4e00\u79cd\u53ef\u4ee5\u6307\u6325\u670d\u52a1\u5668\u52a8\u6001\u58f0\u79f0\u7f51\u9875\u5185\u5bb9\u7684HTML\u6307\u4ee4\u3002 \u901a\u5e38SSI\u53ef\u4ee5\u7528\u6765\u786e\u4fdd\u7f51\u9875\u4e2d\u7684\u4e00\u4e9b\u901a\u7528\u5185\u5bb9\uff0c\u6bd4\u5982\u7248\u6743\u4fe1\u606f\u3001\u8054\u7cfb\u65b9\u5f0f\u3001\u6216\u5bfc\u822a\u4fe1\u606f\u5728\u5168\u7ad9\u6240\u6709\u7f51\u9875\u4e2d\u4fdd\u6301\u4e00\u81f4\u3002\u4f7f\u7528SSI\u663e\u793a\u8fd9\u4e9b\u901a\u7528\u5185\u5bb9\u8fd8\u53ef\u4ee5\u51cf\u8f7b\u7f51\u7ad9\u7ef4\u62a4\u7684\u5de5\u4f5c\u91cf\uff0c\u56e0\u4e3a\u5f53\u9700\u8981\u4fee\u6539\u8fd9\u4e9b\u901a\u7528\u4fe1\u606f\u7684\u65f6\u5019\uff0c\u53ea\u9700\u8981\u6539\u4e00\u4e2a\u5730\u65b9\u5c31\u53ef\u4ee5\u4e86\uff0c\u800c\u4e0d\u9700\u8981\u9010\u4e2a\u4fee\u6539\u6bcf\u4e00\u4e2a\u7f51\u9875\u3002 \u5404\u4e2a\u670d\u52a1\u5668\u5bf9SSI\u547d\u4ee4\u7684\u652f\u6301\u5404\u6709\u4e0d\u540c\uff0c\u4f46 #include \u548c #exec \u662f\u901a\u7528\u7684\u3002\u4f7f\u7528 SSI \u7684\u9875\u9762\u6587\u4ef6\u901a\u5e38\u90fd\u4f7f\u7528\u6269\u5c55\u540d.shtml\uff0c\u800c\u4e0d\u662f.html \u6216 .htm\uff0c\u8fd9\u6837\u4ee5\u4fbf\u670d\u52a1\u5668\u80fd\u591f\u8fa8\u8ba4\u51fa\u54ea\u4e9b\u9875\u9762\u5305\u542bSSI\u6307\u4ee4\uff0c\u8fd9\u4e9b\u9875\u9762\u9700\u8981\u5148\u7ecf\u8fc7\u670d\u52a1\u5668\u5904\u7406\uff0c\u7ffb\u8bd1\u6267\u884c\u5176\u4e2d\u7684SSI\u6307\u4ee4\uff0c\u7136\u540e\u624d\u53d1\u9001\u7ed9\u5ba2\u6237\u7aef\u6d4f\u89c8\u5668\u3002\u00a0 (\u5f53\u7136\u6709\u4e9b\u670d\u52a1\u5668\u8fd8\u662f\u652f\u6301.html,.htm\u6587\u4ef6\u4e2d\u6709SSI\u6307\u4ee4\u7684)\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"_links":{"self":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/posts\/83"}],"collection":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/comments?post=83"}],"version-history":[{"count":12,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/posts\/83\/revisions"}],"predecessor-version":[{"id":85,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/posts\/83\/revisions\/85"}],"wp:attachment":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/media?parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/categories?post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/tags?post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}