Home >Backend Development >PHP Tutorial >How to use pure PHP code to achieve pseudo-static page, php_PHP tutorial
The example in this article describes the method of using pure PHP code to achieve pseudo-static page. Share it with everyone for your reference. The details are as follows:
if(1==URLROLE){ $nav=$_SERVER["REQUEST_URI"]; $script_name=$_SERVER["SCRIPT_NAME"]; $nav1=ereg_replace(".html","",substr(ereg_replace("$script_name","",urldecode($nav)),1)); $vars = @explode("/",$nav1); $_url = array_chunk($vars,2); $_GET['m'] = $vars[0]?$vars[0]:'index'; //如果没有参数,默认访问index类库的index方法 $_GET['a'] = $vars[1]?$vars[1]:'index'; unset($_url[0]); if($_url){ foreach($_url as $key=>$val){ @$_GET[$val[0]] = $val[1]; } } //var_dump($_GET); }
I hope this article will be helpful to everyone’s PHP programming design.