创意电子 管理员
  • 最佳新人

    注册账号后积极发帖的会员
  • 活跃会员

    经常参与各类话题的讨论,发帖内容较有主见
  • 1420发帖数
  • 1327主题数
  • 2关注数
  • 18粉丝
开启左侧

Discuz 修改网站首页为插件或别的链接为首页的方法

[复制链接]
 楼主| 创意电子 发表于 2022-7-21 19:55:09 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
一、电脑版的很简单,论坛有这个功能,在论坛后台界面导航实现,如图:

二、手机版的需要修改index,也很简单,可以用以下方法实现,如图:


修改网站根目录下的index.php文件,直接在<?php下面的/*注释*/下面(如上图)第一行添加以下代码:


注意:以下红色代码部分为要访问的首页链接,示例的链接是积分钱包首页,可以用手机访问,看看效果!

也就是说以下红色链接换成你的链接!


有时发现不能访问插件首页,而是强制跳转到论坛页,可以看教程
  1. if(it618_is_mobile()){ //手机访问时跳转
  2.         header("location:你想设置的插件链接");
  3.         exit;
  4. }

  5. function it618_is_mobile(){
  6.         $user_agent = $_SERVER['HTTP_USER_AGENT'];
  7.         $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","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");
  8.         $is_mobile = false;
  9.         foreach ($mobile_agents as $device) {
  10.         if (stristr($user_agent, $device)) {
  11.         $is_mobile = true;
  12.         break;
  13.         }
  14.         }
  15.         return $is_mobile;
  16. }
复制代码

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

猜你喜欢
在线客服邮箱
wxcy#wkgb.net

邮箱地址#换为@

Powered by 创意电子 ©2018-现在 专注资源实战分享源码下载站联盟商城