首页 > 移动平台 > 详细

fastadmin 的通过配置index.php实现电脑和手机访问分别显示不同的页面

时间:2020-11-30 15:24:12      阅读:133      评论:0      收藏:0      [点我收藏+]

    1.// 加载框架引导文件 

      $user_agent = $_SERVER[‘HTTP_USER_AGENT‘];

    2.//定义应用目录

      define(‘APP_PATH‘, __DIR__ . ‘/../application/‘);

    3.// 加载框架引导文件

      require __DIR__ . ‘/../thinkphp/base.php‘;

    4.// 绑定到模块

      if(stristr($user_agent,‘iPad‘)) {
            \think\Route::bind(‘index‘);
      }else if(stristr($user_agent,‘Android‘)) {
            \think\Route::bind(‘mobile‘);
      }else if(stristr($user_agent,‘iPhone‘)){
            \think\Route::bind(‘mobile‘);
      else{
            \think\Route::bind(‘index‘);
      }
    5.// 关闭路由
      \think\App::route(false);

    6.// 设置根url

      \think\Url::root(‘‘);
    7.// 执行应用
      \think\App::run()->send();
 
 
 
 
 
 

 

fastadmin 的通过配置index.php实现电脑和手机访问分别显示不同的页面

原文:https://www.cnblogs.com/shiguangliushi/p/14060870.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!