{"id":31524,"date":"2024-11-25T15:32:24","date_gmt":"2024-11-25T07:32:24","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31524\/"},"modified":"2024-11-25T15:32:24","modified_gmt":"2024-11-25T07:32:24","slug":"phpcms%e6%89%8b%e6%9c%ba%e7%ab%99%e9%a6%96%e9%a1%b5%e5%a6%82%e4%bd%95%e8%ae%be%e7%bd%ae%e4%bc%aa%e9%9d%99%e6%80%81%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31524\/","title":{"rendered":"phpcms\u624b\u673a\u7ad9\u9996\u9875\u5982\u4f55\u8bbe\u7f6e\u4f2a\u9759\u6001\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/5ee46d5408b7c786.jpg\" class=\"aligncenter\" title=\"phpcms\u624b\u673a\u7ad9\u9996\u9875\u5982\u4f55\u8bbe\u7f6e\u4f2a\u9759\u6001\uff1f\u63d2\u56fe\" alt=\"phpcms\u624b\u673a\u7ad9\u9996\u9875\u5982\u4f55\u8bbe\u7f6e\u4f2a\u9759\u6001\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u624b\u673a\u7ad9\u9996\u9875\u5982\u4f55\u8bbe\u7f6e\u4f2a\u9759\u6001\uff1f<\/strong><\/p>\n<p><strong>phpcms\u624b\u673a\u7ad9\u9996\u9875\u8bbe\u7f6e\u4f2a\u9759\u6001\u7684\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>1\u3001\u6253\u5f00\/phpcms\/modules\/wap\/functions\/global.func.php<\/p>\n<p>\u627e\u5230\u91cc\u9762\u7684\u8fd9\u4e24\u4e2a\u51fd\u6570\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u7684\u6ce8\u91ca\u6389\u7684\u90a3\u884c\u4ee3\u7801\uff0c\u5728\u4e0b\u9762\u52a0\u5165\u4e00\u884c\u4ee3\u7801\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>function&nbsp;list_url($typeid)&nbsp;{\n&nbsp;&nbsp;#return&nbsp;WAP_SITEURL.\"&amp;amp;a=lists&amp;amp;typeid=$typeid\";\n&nbsp;&nbsp;return&nbsp;\"\/list-$typeid\".'.html';\n}\nfunction&nbsp;show_url($catid,&nbsp;$id,&nbsp;$typeid='')&nbsp;{\nglobal&nbsp;$WAP;\nif($typeid=='')&nbsp;{\n&nbsp;$types&nbsp;=&nbsp;getcache('wap_type','wap');\n&nbsp;foreach&nbsp;($types&nbsp;as&nbsp;$type)&nbsp;{\n&nbsp;&nbsp;if($type['cat']==$catid)&nbsp;{\n&nbsp;&nbsp;$typeid&nbsp;=&nbsp;$type['typeid'];\n&nbsp;&nbsp;break;\n&nbsp;&nbsp;}\n&nbsp;}\n}&nbsp;\n&nbsp;&nbsp;#return&nbsp;WAP_SITEURL.\"&amp;amp;a=show&amp;amp;catid=$catid&amp;amp;typeid=$typeid&amp;amp;id=$id\";\n&nbsp;&nbsp;return&nbsp;\"\/show-$catid-$typeid-$id-1\".'.html';\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>2\u3001\u6253\u5f00\/phpcms\/modules\/wap\/index.php<\/p>\n<p>\u627e\u5230\u7b2c59\u884c\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u7684\u6ce8\u91ca\u6389\u7684\u90a3\u884c\u4ee3\u7801\uff0c\u5728\u4e0b\u9762\u52a0\u5165\u4e00\u884c\u4ee3\u7801\u3002<\/p>\n<pre>#define('URLRULE',&nbsp;'index.php?m=wap&amp;amp;c=index&amp;amp;a=lists&amp;amp;typeid={$typeid}~index.php?m=wap&amp;amp;c=index&amp;amp;a=lists&amp;amp;typeid={$typeid}&amp;amp;page={$page}');\ndefine('URLRULE',&nbsp;'list-{$typeid}.html~list-{$typeid}-{$page}.html');<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>3\u3001\u6dfb\u52a0\u4f2a\u9759\u6001\u89c4\u5219<\/p>\n<p>\u6211\u4f7f\u7528\u7684\u662fapache\u670d\u52a1\u5668\uff0c\u628aapache\u670d\u52a1\u5668\u8bbe\u7f6e\u652f\u6301.htaccess\u6587\u4ef6\uff0c\u5728\u7f51\u7ad9\u6839\u76ee\u5f55\u521b\u5efa.htaccess\u6587\u4ef6\uff0c\u5728\u91cc\u9762\u6dfb\u52a0\u4ee3\u7801\uff1a<\/p>\n<p>RewriteEngine On&nbsp;&nbsp;<\/p>\n<pre>RewriteRule&nbsp;^list-([0-9]+)-([0-9]+)&nbsp;index.php?&amp;amp;a=lists&amp;amp;typeid=$1&amp;amp;page=$2\nRewriteRule&nbsp;^list-([0-9]+)&nbsp;index.php?&amp;amp;a=lists&amp;amp;typeid=$1;\nRewriteRule&nbsp;^show-([0-9]+)-([0-9]+)-([0-9]+)&nbsp;index.php?a=show&amp;amp;catid=$1&amp;amp;typeid=$2&amp;amp;id=$3;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>&nbsp; &nbsp; &nbsp;<\/p>\n<p>\u8fd9\u6837\uff0cphpcms\u624b\u673a\u7ad9\u5c31\u53d8\u6210\u4f2a\u9759\u6001\u4e86\u3002<\/p>\n<p>.htaccess\u5982\u4f55\u8bbe\u7f6e\u548c\u521b\u5efa\u53ef\u81ea\u884c\u767e\u5ea6\u4e00\u4e0b\uff0c\u65b9\u6cd5\u90fd\u6bd4\u8f83\u7b80\u5355\uff0c\u8fd9\u91cc\u5c31\u4e0d\u7ec6\u8bf4\u4e86\u3002<\/p>\n<p>\u5982\u679c\u662fnginx\u670d\u52a1\u5668\uff0c\u91cd\u5199\u89c4\u5219\u8fd9\u6837\u5199\uff1a<\/p>\n<pre>rewrite&nbsp;^\/list-([0-9]+).html&nbsp;\/index.php?&amp;amp;a=lists&amp;amp;typeid=$1&nbsp;last;\nrewrite&nbsp;^\/show-([0-9]+)-([0-9]+)-([0-9]+)-1.html&nbsp;\/index.php?a=show&amp;amp;catid=$1&amp;amp;typeid=$2&amp;amp;id=$3&nbsp;last;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u63a8\u8350\u6559\u7a0b\uff1a\u300a\u300b<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u624b\u673a\u7ad9\u9996\u9875\u5982\u4f55\u8bbe\u7f6e\u4f2a\u9759\u6001\uff1f\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>\u624b\u673a\u7ad9\u9996\u9875\u5982\u4f55\u8bbe\u7f6e\u4f2a\u9759\u6001\uff1f phpcms\u624b\u673a\u7ad9\u9996\u9875\u8bbe\u7f6e\u4f2a\u9759\u6001\u7684\u65b9\u6cd5\uff1a 1\u3001\u6253\u5f00\/phpcms\/modules\/wap\/functions\/global.func.php \u627e\u5230\u91cc\u9762\u7684\u8fd9\u4e24\u4e2a\u51fd\u6570\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u7684\u6ce8\u91ca\u6389\u7684\u90a3\u884c\u4ee3\u7801\uff0c\u5728\u4e0b\u9762\u52a0\u5165\u4e00\u884c\u4ee3\u7801\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b function&nbsp;list_url($typeid)&nbsp;{ &nbsp;&nbsp;#return&nbsp;WAP_SITEURL.&#8221;&amp;amp;a=lists&amp;amp;typeid=$typeid&#8221;; &nbsp;&nbsp;return&nbsp;&#8220;\/list-$typeid&#8221;.&#8217;.html&#8217;; } function&nbsp;show_url($catid,&nbsp;$id,&nbsp;$typeid=&#8221;)&nbsp;{ global&nbsp;$WAP; if($typeid==&#8221;)&nbsp;{ &nbsp;$types&nbsp;=&nbsp;getcache(&#8216;wap_type&#8217;,&#8217;wap&#8217;); &nbsp;foreach&nbsp;($types&nbsp;as&nbsp;$type)&nbsp;{ &nbsp;&nbsp;if($type[&#8216;cat&#8217;]==$catid)&nbsp;{ &nbsp;&nbsp;$typeid&nbsp;=&nbsp;$type[&#8216;typeid&#8217;]; &nbsp;&nbsp;break; &nbsp;&nbsp;} &nbsp;} }&nbsp; &nbsp;&nbsp;#return&nbsp;WAP_SITEURL.&#8221;&amp;amp;a=show&amp;amp;catid=$catid&amp;amp;typeid=$typeid&amp;amp;id=$id&#8221;; &nbsp;&nbsp;return&nbsp;&#8220;\/show-$catid-$typeid-$id-1&#8221;.&#8217;.html&#8217;; } \u767b\u5f55\u540e\u590d\u5236 2\u3001\u6253\u5f00\/phpcms\/modules\/wap\/index.php \u627e\u5230\u7b2c59\u884c\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u7684\u6ce8\u91ca\u6389\u7684\u90a3\u884c\u4ee3\u7801\uff0c\u5728\u4e0b\u9762\u52a0\u5165\u4e00\u884c\u4ee3\u7801\u3002 #define(&#8216;URLRULE&#8217;,&nbsp;&#8216;index.php?m=wap&amp;amp;c=index&amp;amp;a=lists&amp;amp;typeid={$typeid}~index.php?m=wap&amp;amp;c=index&amp;amp;a=lists&amp;amp;typeid={$typeid}&amp;amp;page={$page}&#8217;); define(&#8216;URLRULE&#8217;,&nbsp;&#8216;list-{$typeid}.html~list-{$typeid}-{$page}.html&#8217;); \u767b\u5f55\u540e\u590d\u5236 3\u3001\u6dfb\u52a0\u4f2a\u9759\u6001\u89c4\u5219 \u6211\u4f7f\u7528\u7684\u662fapache\u670d\u52a1\u5668\uff0c\u628aapache\u670d\u52a1\u5668\u8bbe\u7f6e\u652f\u6301.htaccess\u6587\u4ef6\uff0c\u5728\u7f51\u7ad9\u6839\u76ee\u5f55\u521b\u5efa.htaccess\u6587\u4ef6\uff0c\u5728\u91cc\u9762\u6dfb\u52a0\u4ee3\u7801\uff1a RewriteEngine On&nbsp;&nbsp; RewriteRule&nbsp;^list-([0-9]+)-([0-9]+)&nbsp;index.php?&amp;amp;a=lists&amp;amp;typeid=$1&amp;amp;page=$2 RewriteRule&nbsp;^list-([0-9]+)&nbsp;index.php?&amp;amp;a=lists&amp;amp;typeid=$1; RewriteRule&nbsp;^show-([0-9]+)-([0-9]+)-([0-9]+)&nbsp;index.php?a=show&amp;amp;catid=$1&amp;amp;typeid=$2&amp;amp;id=$3; \u767b\u5f55\u540e\u590d\u5236 &nbsp; &nbsp; &nbsp; \u8fd9\u6837\uff0cphpcms\u624b\u673a\u7ad9\u5c31\u53d8\u6210\u4f2a\u9759\u6001\u4e86\u3002 .htaccess\u5982\u4f55\u8bbe\u7f6e\u548c\u521b\u5efa\u53ef\u81ea\u884c\u767e\u5ea6\u4e00\u4e0b\uff0c\u65b9\u6cd5\u90fd\u6bd4\u8f83\u7b80\u5355\uff0c\u8fd9\u91cc\u5c31\u4e0d\u7ec6\u8bf4\u4e86\u3002 \u5982\u679c\u662fnginx\u670d\u52a1\u5668\uff0c\u91cd\u5199\u89c4\u5219\u8fd9\u6837\u5199\uff1a rewrite&nbsp;^\/list-([0-9]+).html&nbsp;\/index.php?&amp;amp;a=lists&amp;amp;typeid=$1&nbsp;last; rewrite&nbsp;^\/show-([0-9]+)-([0-9]+)-([0-9]+)-1.html&nbsp;\/index.php?a=show&amp;amp;catid=$1&amp;amp;typeid=$2&amp;amp;id=$3&nbsp;last; \u767b\u5f55\u540e\u590d\u5236 \u63a8\u8350\u6559\u7a0b\uff1a\u300a\u300b \u4ee5\u4e0a\u5c31\u662f\u624b\u673a\u7ad9\u9996\u9875\u5982\u4f55\u8bbe\u7f6e\u4f2a\u9759\u6001\uff1f\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-31524","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31524","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=31524"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31524\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}