<?php
/*
功能:PHP偽靜態化頁面的實現
具體用法:
例如鏈接為:test.php/year/2006/action/_add.html
mod_rewrite();
$yearn= $_GET["year"];//結果為'2006'
$action= $_GET["action"];//結果為'_add'
Power By:cnwbshow.com
E-mail:[email protected]
網址:http://www.cnwbshow.com*/
function mod_rewrite(){
global $_GET;
$nav= $_SERVER["REQUEST_URI"];
$script_name= $_SERVER["SCRIPT_NAME"];
$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;
}
>