Home > php教程 > php手册 > 通过PATH_INFO方法实现页面伪静态

通过PATH_INFO方法实现页面伪静态

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-21 08:58:18
Original
1345 people have browsed it

/* 

 函数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 

    {       

        if (isset($url[$i + 1]) && !is_numeric($url[$i]))  

        {       

            $_GET[$url[$i]] = $url[$i + 1];       

        }       

    }       

    unset($param_count,$url,$i);       

}       

?>   



Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template