让PHPCMS V9的动态网址越发清洁的步伐

  PHPCMS V9默认的动态页面网址太长了,好比默认的

栏目网址为:/index.php?m=content&c=index&a=lists&catid=9;

内容页面网址为:/index.php?m=content&c=index&a=show&catid=11&id=46

  通过修改,我们可以用越发清洁、简短的网址(/index.php/a/lists/catid/9/和/index.php/a/show/catid/11/id/46/index.html)来会见它们。

  打开\phpcms\libs\functions\extention.func.php文件,在末端的“?>”前面添加以下代码:

global $_URLCFG;
$_URLCFG=array();
$_URLCFG['urlmode']=2;
$_URLCFG['urlsuffix']='index.html';
getQueryString();
/**
* 得到友好的URL会见
*
* @access public
* @return array
*/
function getQueryString(){
global $_URLCFG;
if($_URLCFG['urlmode']!=2) return $_GET;
$path = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');
if(!$path){
$script_name=$_SERVER['SCRIPT_NAME'];//获取当前文件的路径
$path= $_SERVER['REQUEST_URI'];//获取完整的路径,包括"?"之后的字符串
//去除url包括的当前文件的路径信息
if($path && @strpos($path,$script_name,0)!==false)
{
if($path!=$script_name) $path=substr($path,strlen($script_name));
}else{
$script_name=str_replace(basename($script_name),'',$script_name);
if($path && @strpos($path,$script_name,0)!==false){
$path=substr($path,strlen($script_name));
}
}
//第一个字符是'http://down.chinaz.com/',则去掉
if($path[0]!='http://down.chinaz.com/'){
$path='http://down.chinaz.com/'.$path;
}
if(strpos($path,'/index.php')===0) $path=preg_replace('|^/index\\.php|','',$path);
//去除问号后头的查询字符串
if($path && false!==($pos=@strrpos($path,'?'))){
$path=substr($path,0,$pos);
}
}
$_SGETS = explode('http://down.chinaz.com/',substr($path,1));
$_SLEN = count($_SGETS);
$_SGET =& $_GET;
for($i=0;$i<$_SLEN;$i+=2){
if(!empty($_SGETS[$i]) && !empty($_SGETS[$i+1])) $_SGET[$_SGETS[$i]]=$_SGETS[$i+1];
}

$_SGET['m'] = !empty($_SGET['m']) && is_string($_SGET['m']) ? trim($_SGET['m']) : '';
$_SGET['c'] = !empty($_SGET['c']) && is_string($_SGET['c']) ? trim($_SGET['c']) : '';
$_SGET['a'] = !empty($_SGET['a']) && is_string($_SGET['a']) ? trim($_SGET['a']) : '';
return $_SGET;
}

  进入靠山-》扩展-》修改URL法则:

让PHPCMS V9的动态网址加倍洁净的步骤

  1、将内容模块本来默认的动态category URL法则修改为:

/index.php/a/lists/catid/{$catid}/index.html|/index.php/a/lists/catid/{$catid}/page/{$page}/index.html

  2、将内容模块本来默认的动态show URL法则修改为:

index.php/a/show/catid/{$catid}/id/{$id}/index.html|index.php/a/show/catid/{$catid}/id/{$id}/page/{$page}/index.html

  3、进入“内容”打点页面,别离更新栏目缓存和更新URL网址

PHPCMS v9.6.0 GBK下载

让PHPCMS V9的动态网址加倍洁净的步骤

让PHPCMS V9的动态网址加倍洁净的步骤

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/10257.html