View Single Post
  #2   IP: 82.116.154.18
Old 2009-01-05, 04:52 PM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default

Code:
<?php
function mod_rewrite(){
     global $_GET;
     //$nav=$_SERVER["REQUEST_URI"];
     $nav = '/129244/index.html';
     //$script_name=$_SERVER["SCRIPT_NAME"];
     $script_name = '/index.html';
     $nav=substr(ereg_replace("^$script_name","",urldecode($nav)),1);
     $nav=preg_replace("/^.ht(m){1}(l){0,1}$/","",$nav);//这句是去掉尾部的.html或.htm
     $vars = explode("/",$nav);
     for($i=0;$i<Count($vars);$i+=2){
          $_GET["$vars[$i]"]=$vars[$i+1];
     }
     return $_GET;
}
$aa = mod_rewrite();
var_dump($aa);
echo '<br>';
var_dump($_SERVER["REQUEST_URI"]);
?>
这样看就明白了
发的那个函数只是对请求的url进行了分解,具体的操作还需要你根据你的url情况自己解决
Reply With Quote