Home >Backend Development >PHP Tutorial >How to use pure PHP code to achieve pseudo-static page, php_PHP tutorial

How to use pure PHP code to achieve pseudo-static page, php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:45:561061browse

How to use pure PHP code to achieve pseudo-static page, php

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1038588.htmlTechArticleHow to use pure PHP code to achieve pseudo-static page, php This article describes the use of pure PHP code to achieve pseudo-static page method. Share it with everyone for your reference. The details are as follows: if(1...
Statement:
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