聯(lián)系官方銷售客服
1835022288
028-61286886
準(zhǔn)備自己搭建虛擬版的城市分站
借助聯(lián)動菜單
首先自編URL:
index.php?c=show&id=28921&city=123(可以正常訪問,且可以獲取數(shù)據(jù))
在模板里用下面的代碼獲取city的值(聯(lián)動菜單的ID值)。
<?php $url=$_SERVER["QUERY_STRING"]; $city = substr($url,strripos($url,"city=")+5); ?>
再用獲取城市地名:
內(nèi)容:{dr_linkage('address',$city,0,'name')}
現(xiàn)在要解決地址靜態(tài)化的問題
我用下面的代碼:
"([A-za-z0-9 \-\_]+)\/u([0-9]+)\/([0-9]+)\.html" => "index.php?c=show&id=$2&city=$1",
訪問如:http://192.168.0.100/zixun/u121/200.html
其中u121中的121是城市ID
其中200.html中的200是文章ID
得到的是id為121的內(nèi)容了。該如何解決。
求大俠幫助,謝謝。
附rewrite.php全部代碼!
<?php /** * URL解析規(guī)則 * 例如: 114.html 對應(yīng) index.php?s=demo&c=show&id=114 * 可以解析: "114.html" => 'index.php?s=demo&c=show&id=114', * 動態(tài)id解析: "([0-9]+).html" => 'index.php?s=demo&c=show&id=$1', */ return [ "list-([A-za-z0-9 \-\_]+)-([0-9]+)\.html" => "index.php?c=category&dir=$1&page=$2", //【不帶欄目路徑】模塊欄目列表(分頁)(list-{dirname}-{page}.html) "list-([A-za-z0-9 \-\_]+)\.html" => "index.php?c=category&dir=$1", //【不帶欄目路徑】模塊欄目列表(list-{dirname}.html) "show-([0-9]+)\.html" => "index.php?c=show&id=$1", //【不帶欄目路徑】模塊內(nèi)容頁(show-{id}.html "([A-za-z0-9 \-\_]+)\/p([0-9]+)\.html" => "index.php?c=category&dir=$1&page=$2", //【帶欄目路徑】模塊欄目列表(分頁)({dirname}/p{page}.html) "([A-za-z0-9 \-\_]+)\/([0-9]+)\.html" => "index.php?c=show&id=$2", //【帶欄目路徑】模塊內(nèi)容頁({dirname}/{id}.html) "([A-za-z0-9 \-\_]+)" => "index.php?c=category&dir=$1", //【帶欄目路徑】模塊欄目列表({dirname}) //城市分站內(nèi)容 "([A-za-z0-9 \-\_]+)\/u([0-9]+)\/([0-9]+)\.html" => "index.php?c=show&id=$2&city=$1", ];
正則表達(dá)式技術(shù)不合格
回復(fù)@迅??蚣苈?lián)合創(chuàng)始人
老師批評得是,感謝,已解決。