/*
函数url_parse用于解析url,使用时需要在前面定义
define('PATH_INFO',true);
需要解析时调用该函数,取值方法用回$_GET['xxx']即可
*/
function url_parse()
{
if(!(isset($_SERVER['PATH_INFO'])&&defined('PATH_INFO'))){return;}
$url = substr($_SERVER['PATH_INFO'], 1);
$url = str_replace(array("'",'"','.htm','.html'), array('','','',''),$url);
$url = explode('/', $url);
$param_count = count($url);
for ($i = 0; $i < $param_count; $i += 2)
{
if (isset($url[$i + 1]) && !is_numeric($url[$i]))
{
$_GET[$url[$i]] = $url[$i + 1];
}
}
unset($param_count,$url,$i);
}
?>
时间: 2024-09-23 13:53:10