·设为首页收藏本站📧邮箱修改🎁免费下载专区💎积分购买✅卡密充值📒收藏夹🎖️众筹悬赏👽聊天室
返回列表 发布新帖

关于手机版伪静态问题!

643 3
发表于 2022-2-21 11:24:31 | 查看全部 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
在网上找到手机版伪静态教程如下:
1、在移动版中,找到source\class\helper\helper_mobile.php中的函数 mobilereplace,修改成如下所示:

public static function mobilereplace($file, $replace) {
if(strpos($replace, 'mobile=') === false) {
if(strpos($replace, '?') === false) {
$replace = 'href="'.$file.$replace.'?mobile='.IN_MOBILE.'"';
} else {
$replace = 'href="'.$file.$replace.'&mobile='.IN_MOBILE.'"';
//$replace=str_replace('&mobile=2','',$replace);
$replace=mbrewriteoutput($replace);
}
return $replace;
} else {
return 'href="'.$file.$replace.'"';
}
}


2、然后在source/function/function_core.php中增加函数


function mbrewriteoutput($eurl) {
                if(strstr($eurl,"forum.php?mod=forumdisplay&fid=")){
                $eurl=str_replace('&mobile=2','',$eurl);
                        $fidarr=explode("fid=",$eurl);
                        $fid=$fidarr[1];
                        $fid=str_replace('"','',$fid);
                        $eurl=str_replace('forum.php?mod=forumdisplay&fid='.$fid,'forum-'.$fid.'-1.html',$eurl);
                        $eurl=str_replace('forum.php?mod=forumdisplay&fid='.$fid,'forum-'.$fid.'-1.html',$eurl);
                        return $eurl;
                }elseif(strstr($eurl,"forum.php?mod=viewthread&tid=")){
                        $eurl=str_replace('&extra=page%3D1&mobile=2','',$eurl);
                        $tidarr=explode("tid=",$eurl);
                        $tid=$tidarr[1];
                        $tid=str_replace('"','',$tid);
                        $eurl=str_replace('forum.php?mod=viewthread&tid='.$tid,'thread-'.$tid.'-1-1.html',$eurl);
                        $eurl=str_replace('forum.php?mod=viewthread&tid='.$tid,'thread-'.$tid.'-1-1.html',$eurl);
                        return $eurl;
                }elseif(strstr($eurl,"forum.php?forumlist=1&mobile=2")){
                        $eurl=str_replace('forum.php?forumlist=1&mobile=2','https://网站.com/',$eurl);
                        return $eurl;
                }
                return $eurl;
}
这样就可以实现手机伪静态



教程来源:365建站网
我要说一句 收起回复
创宇盾启航版免费网站防御网站加速服务

评论3

CrystαlLv.8 发表于 2022-2-21 11:25:15 | 查看全部
在默认规则情况下,手机版伪静态正常
关于手机版伪静态问题! 关于,手机,机版,伪静态,问题
我要说一句 收起回复
婷姐Lv.8 发表于 2022-2-21 11:25:48 | 查看全部
修改规则的话就出现网址变长的问题
关于手机版伪静态问题! 关于,手机,机版,伪静态,问题
function mbrewriteoutput($eurl) {
                if(strstr($eurl,"forum.php?mod=forumdisplay&fid=")){
                $eurl=str_replace('&mobile=2','',$eurl);
                        $fidarr=explode("fid=",$eurl);
                        $fid=$fidarr[1];
                        $fid=str_replace('"','',$fid);
                        $eurl=str_replace('forum.php?mod=forumdisplay&fid='.$fid,'korea/'.$fid.'/1.html',$eurl);
                        $eurl=str_replace('forum.php?mod=forumdisplay&fid='.$fid,'korea/'.$fid.'/1.html',$eurl);
                        return $eurl;
                }elseif(strstr($eurl,"forum.php?mod=viewthread&tid=")){
                        $eurl=str_replace('&extra=page%3D1&mobile=2','',$eurl);
                        $tidarr=explode("tid=",$eurl);
                        $tid=$tidarr[1];
                        $tid=str_replace('"','',$tid);
                        $eurl=str_replace('forum.php?mod=viewthread&tid='.$tid,'hanguo/'.$tid.'/1/1.html',$eurl);
                        $eurl=str_replace('forum.php?mod=viewthread&tid='.$tid,hanguo/'.$tid.'/1/1.html',$eurl);
                        return $eurl;
                }elseif(strstr($eurl,"forum.php?forumlist=1&mobile=2")){
                        $eurl=str_replace('forum.php?forumlist=1&mobile=2','https://网站.com/',$eurl);
                        return $eurl;
                }
                return $eurl;
}



手机版为静态的网址变长,变成这样:
http://www.网址.com/korea/11334&fromguid=hot&extra=&mobile=2/1/1.html
http://www.网址.com/korea/11326&fromguid=hot&extra=&mobile=2/1/1.html
http://www.网址.com/hanguo/139&/1.html

请问是哪里的问题?
谢谢了!
我要说一句 收起回复
CrystαlLv.8 发表于 2022-2-21 11:26:37 | 查看全部
请问管理员,这个帖子能删除吗?连接:https://www.dismall.com/thread-11631-1-1.html
都是同样的问题,但那个问题问的太乱,我自己都要看不明白了。

所以,重新整了发了一贴!
谢谢了!
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

创宇盾启航版免费网站防御网站加速服务
投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图 知道创宇云防御

您的IP:3.139.81.220,GMT+8, 2024-9-19 09:46 , Processed in 0.233399 second(s), 95 queries , Gzip On, Redis On.

Powered by Discuz! X5.0 Licensed

© 2001-2024 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表