创意电子 发表于 2022-7-21 19:55:09

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

一、电脑版的很简单,论坛有这个功能,在论坛后台界面导航实现,如图:

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


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


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

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


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

function it618_is_mobile(){
      $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","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");
      $is_mobile = false;
      foreach ($mobile_agents as $device) {
      if (stristr($user_agent, $device)) {
      $is_mobile = true;
      break;
      }
      }
      return $is_mobile;
}
页: [1]
查看完整版本: Discuz 修改网站首页为插件或别的链接为首页的方法