欢迎访问 舍力博客(www.shuyong.net)

    打开支付宝首页搜索“8831244”,即可领红包

当前位置:首页 » 网站模板 » 手机版模板,手机访问时显示主页不变,slm主题

打开支付宝首页搜索“8831244”,即可领红包

手机版模板,手机访问时显示主页不变,slm主题

日期:2017-06-19   分类:网站模板
一个简单的手机模板,当手机访问时才会触发。请上传时候一定要备份,因未备份导致的一切问题,自行解决。

使用方法:
1、在原模板的module.php文件中加入下面代码,不要问我放那个位置,你想放哪里位置都可以
<?php 
function sywap(){ 
$user_agent = $_SERVER['HTTP_USER_AGENT']; 
$mobile_agents = array("240x320","acer","acoon","acs-","abacho","ahong","airness","alcatel","amoi","android","anywhereyougo.com","applewebkit/525","applewebkit/532","asus","audio", "au-mic","avantogo","becker","benq","bilbo","bird","blackberry","blazer","bleu","cdm-","compal","coolpad","danger","dbtel","dopod","elaine","eric","etouch","fly ","fly_","fly-","go.web","goodaccess","gradiente","grundig","haier","hedy","hitachi","htc","huawei","hutchison","inno","ipad","ipaq","iphone","ipod","jbrowser","kddi","kgt","kwc","lenovo","lg ","lg2","lg3","lg4","lg5","lg7","lg8","lg9","lg-","lge-","lge9","longcos","maemo","mercator","meridian","micromax","midp","mini","mitsu","mmm","mmp","mobi","mot-","moto","nec-","netfront","newgen","nexian","nf-browser","nintendo","nitro","nokia","nook","novarra","obigo","palm","panasonic","pantech","philips","phone","pg-","playstation","pocket","pt-","qc-","qtek","rover","sagem","sama","samu","sanyo","samsung","sch-","scooter","sec-","sendo","sgh-","sharp","siemens","sie-","softbank","sony","spice","sprint","spv","symbian","tablet","talkabout","tcl-","teleca","telit","tianyu","tim-","toshiba","tsm","up.browser","utec","utstar","verykool","virgin","vk-","voda","voxtel","vx","wap","wellco","wig browser","wii","windows ce","wireless","xda","xde","zte"); 
$sywap = false;foreach($mobile_agents as $device){if(stristr($user_agent, $device)) {$sywap = true;break;}}return $sywap;}?>
2、在原模板header.php找到require_once View::getView('module');后面加入代码
<?php if(sywap()){include View::getView('slm/head');exit;}?>
3、下载本模板文件,然后直接上传到下载使用的模板目录中,例如:现在使用的是默认模板,则上传到default文件中

以上3步就完成了,请在未修改的情况下测试,上传后请使用手机访问查看,电脑是不会显示的。
slm.jpg

文件请在QQ群文件中下载,如有疑问可在本页留言或者QQ群中咨询。
温馨提示:如果您对本文有疑问,请在本页留言即可,其他途径暂不回复!!!
blogger
    本页正文内容约1826个文字
    本文地址:https://www.shuyong.net/template/957.html
    除非注明,文章均为 【舍力博客】 原创,欢迎转载!转载请注明本文地址,谢谢!
    百度未收录
觉得很赞 (7)打赏
X
打赏方式:
  • 支付宝
  • 微信
  • QQ红包

打开支付宝扫一扫
打开支付宝首页搜索“8831244”,即可领红包

留言/评论:◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

填写好QQ号码,任点空白处自动获取

昵称

邮箱

网址

2楼、Power [回复该留言]
2018-02-26 13:53
不错不错
1楼、Chelders [回复该留言]
2017-06-25 02:19
时间那么贵,留给相处不累的人!

个人资料

舍力

博主:舍力

Emlog交流群

    网站制作
    1、博客网站以Emlog为程序;
    2、企业网站建议以米拓MetInfo为程序,当然也可以用Emlog来做。

广告赞助

博客统计

  • 文章数量:1049篇
  • 文章评论:3134条
  • 总访问量:3344261次
  • 微语数量:50条
  • 在线人数:3人
  • 本站运行:5年2月23天
  • 博主很懒,今天什么都没留下!
PC端所有页面:广告位3,招租联系QQ345952779
Copyright © 2018 舍力博客 版权所有   粤ICP备11021420号-2
基于宝塔面板,数据存储于阿里云ECS
努力写好每一个代码,用心服务每一位用户
Powered by emlog / &Author 舍力博客.