分享

PHPCMS v9手机伪静态方法

 礼仪之邦U 2018-06-19
                                                  群里很多朋友问到phpcms v9手机站如何伪静态,今天B5教程网分享一下教程给大家,希望对大家有所帮助。

1、打开/phpcms/modules/wap/functions/global.func.php
找到里面的这两个函数,如下图所示的注释掉的那行代码,在下面加入一行代码。

  1. function list_url($typeid) { 
  2.     #return WAP_SITEURL."&a=lists&typeid=$typeid"; 
  3.     return "/list-$typeid".'.html'; 
  4.  
  5.  
  6.  
  7. function show_url($catid, $id, $typeid='') { 
  8. global $WAP; 
  9. if($typeid=='') { 
  10.   $types = getcache('wap_type','wap'); 
  11.   foreach ($types as $type) { 
  12.    if($type['cat']==$catid) { 
  13.     $typeid = $type['typeid']; 
  14.     break; 
  15.    } 
  16.   } 
  17. }   
  18.     #return WAP_SITEURL."&a=show&catid=$catid&typeid=$typeid&id=$id"; 
  19.     return "/show-$catid-$typeid-$id-1".'.html'; 

2、打开/phpcms/modules/wap/index.php
找到第59行,如下图所示的注释掉的那行代码,在下面加入一行代码。

  1. #define('URLRULE', 'index.php?m=wap&c=index&a=lists&typeid={$typeid}~index.php?m=wap&c=index&a=lists&typeid={$typeid}&page={$page}'); 
  2.  
  3. define('URLRULE', 'list-{$typeid}.html~list-{$typeid}-{$page}.html'); 

3、添加伪静态规则,打开根目录的权限文件,添加如下代码

 

  1. RewriteRule ^list-([0-9]+)-([0-9]+) index.php?&a=lists&typeid=$1&page=$2 
  2. RewriteRule ^list-([0-9]+) index.php?&a=lists&typeid=$1; 
  3. RewriteRule ^show-([0-9]+)-([0-9]+)-([0-9]+) index.php?a=show&catid=$1&typeid=$2&id=$3; 

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多