微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PHPWIND7.5简单教程之伪静态设置

  本教程进行了一些规范设定,主题列表一律用commtopics-,,主题内容一律用article-分割.简单的说,板块做到目录式,内容做到独立地址式,也避免了和无图版冲突。

  使用的前提条件是 支持Rewrite 即在IIS/apache/Nginx 有伪静态模块支持,或者虚拟主机的上的 .htaccess 又或 httpd.ini ,关于这些基础理论请大家各自查教程或者谷歌下。

  附件是7.5已改好的懒人包,需要的同学,都可以下载!

  第一步:

  添加规则

  #虚拟主机:

以下为引用的内容
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^commtopics-(.*)-(.*) thread.PHP?fid=$1&page=$2
RewriteRule ^commtopics-(.*) thread.PHP?fid=$1&page=$2
RewriteRule ^article-(.*)-(.*)-(.*).html read.PHP?tid=$1&page=$2&fpage=$3
RewriteRule ^article-(.*)-(.*).html read.PHP?tid=$1&page=$2&fpage=$3
RewriteRule ^article-(.*).html read.PHP?tid=$1
RewriteRule ^(.*)-htm-(.*)$ $1.PHP?$2
RewriteRule ^(.*)/simple/([a-z0-9\_]+.html)$ $1/simple/index.PHP?$2
</IfModule>

  然后将global.PHP打开,找到523行

以下为引用的内容
function Htm_cv($url,$tag){
global $db_dir,$db_ext;
$tmppos = strpos($url,'#');
$add = $tmppos!==false ? substr($url,$tmppos) : '';
$url = str_replace(
array('.PHP?','=','&',$add),
array($db_dir,'-',''),
$url
).$db_ext.$add;
return stripslashes($tag).$url;
}

  全部替换为:

以下为引用的内容
function Htm_cv($url,$tag){//modify By Josh
global $db_dir,$db_ext;
if (!preg_match('/^(http|ftp|telnet|mms|rtsp)|admin.PHP|RSS.PHP/i',$url)){
$add = strpos($url,'#') !== false ? substr($url,strpos($url,'#')) : '';
if(strpos($url,'thread.PHP?') !== false){
unset($rw); //$rw->type $ru->array
$thread_arr = explode('&',substr(str_replace($add,'',$url),11));
foreach($thread_arr as $key => $value){
$ru = explode('=',$value,2);
if($ru['1']){
switch($ru['0']){
case 'fid':
$rw['fid'] = $ru['1'];
$rw['type'] < 1 && $rw['type'] = 1;
break;
case 'page':
$rw['page'] = $ru['1'];
$rw['type'] < 2 && $rw['type'] = 2;
break;
default:
$rw['type'] = 4;
$urlfail = 1;
break;
}}}
switch($rw['type']){
case '1':
$url = commtopics- . $rw['fid'] ; break;
case '2':
$url = commtopics- . $rw['fid'] . - . $rw['page'] ; break;
}}elseif(strpos($url,'read.PHP?') !== false){
unset($rw);
$read_arr = explode('&',9));
foreach($read_arr as $key => $value){
$ru = explode('=',2);
if($ru['1']){
switch($ru['0']){
case 'tid':
$rw['tid'] = $ru['1'];
$rw['type'] < 1 && $rw['type'] = 1;
break;
case 'page':
$rw['page'] = $ru['1'];
$rw['type'] < 2 && $rw[type] = 2;
break;
case 'fpage':
$rw['fpage'] = $ru['1'];
$rw['type'] < 3 && $rw['type'] = 3;
break;
default:
$rw['type'] = 4;
$urlfail = 1;
break;
}}}
switch($rw['type']){
case '1':
$url = article-.$rw['tid'] . .html;
break;
case '2':
$url = article-.$rw['tid'] . - . $rw['page'] . .html;
break;
case '3':
$url = article-. $rw['tid'] . - . $rw['page'] . - . $rw['fpage'] . .html;
break;
}
}
if($urlfail){
$url = str_replace(
array('.PHP?',
$url
) . $db_ext . $add;
}
}
return stripslashes($tag) . $url;
}

  附件下载:09100R11612.rar

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐