PHP僞靜態頁面函數

PHP僞靜態頁面函數 ( 2006-9-23 16:14 )

function MakeUrl($arr){
         foreach(
$arr as $key=>$value
){
                 
$url[]=$key."_".$value
;
                 }
         
$tmpurl=implode("_",$url
);
         return 
$tmpurl.".htm"
;
         }

function 
ParseUrl
(){
    if(
$_SERVER['PATH_INFO']!=""
){
         
$pathinfo=substr($_SERVER['PATH_INFO'],1
);
         
$pathinfo=str_replace(".htm","",$pathinfo
);
         
$path=explode("_",$pathinfo
);
         
$count=count($path
);
         for(
$i=0;$i<$count;$i+=2
){
                 
$_GET[$path[$i]]=$path[$i+1
];
                 }
                 }
         }
//使用實例,連接頁面
$path="http://www.dayanmei.com/blog.php/"
;
$path.=MakeUrl(array('BlogID'=>2,'page'=>1
));
//瀏覽頁面,調用函數ParseUrl();直接可使用變量$_GET 


php

相關文章
相關標籤/搜索