php伪静态的写法是什么
php伪静态的写法:首先打开编辑器;然后输入方法代码【$_GET[$Php2Html_TmpArray[0] = $Php2Html_TmpArray[1];print_r($_GET)】。
城固网站建设公司创新互联建站,城固网站设计制作,有大型网站制作公司丰富经验。已为城固成百上千提供企业网站建设服务。企业网站搭建\外贸网站建设要多少钱,请找那个售后服务好的城固做网站的公司定做!
【相关学习推荐:php图文教程】
php伪静态的写法:
伪静态方法一
";// /php100/test.php?id|1@action|2 $Php2Html_UrlString = str_replace("?","",str_replace("/", "", strrchr(strrchr($Php2Html_FileUrl, "/"),"?"))); echo $Php2Html_UrlString."
";// id|1@action|2 $Php2Html_UrlQueryStrList = explode("@", $Php2Html_UrlString); print_r($Php2Html_UrlQueryStrList);// Array ( [0] => id|1 [1] => action|2 ) echo "
"; foreach($Php2Html_UrlQueryStrList as $Php2Html_UrlQueryStr) { $Php2Html_TmpArray = explode("|", $Php2Html_UrlQueryStr); print_r($Php2Html_TmpArray);// Array ( [0] => id [1] => 1 ) ; Array ( [0] => action [1] => 2 ) echo "
"; $_GET[$Php2Html_TmpArray[0] = $Php2Html_TmpArray[1]; } //echo '假静态:$_GET变量
'; print_r($_GET); // Array ( [id|1@action|2] => [id] => 1 [action] => 2 ) echo "
"; echo "
"; echo $_GET[id]."
";// 1 echo $_GET[action];// 2 ?>
伪静态方法二
";// /php100/test.php echo $filename."
";// test.php if(strtolower($filename)=='test.php'){ if(!empty($_GET[id])){ $id=intval($_GET[id]); echo $id."
"; $action=intval($_GET[action]); echo $action."
"; }else{ $nav=$_SERVER['REQUEST_URI']; echo "1:".$nav."
";// /php100/test.php/1/2 $script=$_SERVER['SCRIPT_NAME']; echo "2:".$script."
";// /php100/test.php $nav=ereg_replace("^$script","",urldecode($nav)); echo $nav."
"; // /1/2 $vars=explode("/",$nav); print_r($vars);// Array ( [0] => [1] => 1 [2] => 2 ) echo "
"; $id=intval($vars[1]); $action=intval($vars[2]); } echo $id.'&'.$action; } ?>
伪静态方法三
"; $script_name=$_SERVER["SCRIPT_NAME"]; echo $script_name."
"; $nav=substr(ereg_replace("^$script_name","",urldecode($nav)),1); echo $nav."
"; $nav=preg_replace("/^.ht(m){1}(l){0,1}$/","",$nav);//这句是去掉尾部的.html或.htm echo $nav."
"; $vars = explode("/",$nav); print_r($vars); echo "
"; for($i=0;$i"; $action=$_GET["action"];//结果为'_add' echo $action; ?>
伪静态方法四
相关学习推荐:php编程(视频)
网页标题:php伪静态的写法是什么
URL地址:http://scyanting.com/article/cpdsdi.html