Home >php教程 >php手册 >使用纯php代码实现页面伪静态的方法,php

使用纯php代码实现页面伪静态的方法,php

WBOY
WBOYOriginal
2016-06-13 08:57:19893browse

使用纯php代码实现页面伪静态的方法,php

本文实例讲述了使用纯php代码实现页面伪静态的方法。分享给大家供大家参考。具体如下:

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);
}

希望本文所述对大家的php程序设计有所帮助。

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