拿http://www.xxx.com/xxx/test.php/article.123456.html來說事吧.
這樣的格式來表示_GET
http://www.xxx.com/xxx/test.php/article.123456.html
http://www.xxx.com/xxx/test.php?article=123456
==================================
哪種格式更帥呢.
代碼如下:
CODE:$path_info =$_SERVER["PATH_INFO"]; //取得PATH_INFO
/*用正則來匹配 "/article.123456.html"*/
if(eregi("^/[a-z]{1,16}.[0-9]{1,16}.html$",$path_info)) {
echo "OK";
$get_path=substr($path_info,1,-5);//處理造型:D 去掉"/",".html"
$arr_path=explode('.',$get_path);//處理成數組備用
//以下是打印出數組看看我們有沒有搞錯的哦.:cool:
foreach ($arr_path as $key=>$value){
echo '$arr_path['.$key.']:'.$value."<br >";
}
}else echo "NO";
結果如下
CODE: $arr_path[0]:article
$arr_path[1]:123456
直接當$_GET使用吧,呵呵.PHP生成偽靜態就是這麼簡單