ecshop手机自动识别ua自动跳转到手机版参考代码

/* 修改 by www.ecshop.cx start 手机识别  ?is_pc=1 表示pc版 不判断ua */
if (isset($_REQUEST['is_pc']))
{
    $is_pc = intval($_REQUEST['is_pc']);
}
if ($is_pc == 1)
{
    ecs_header("Location: https://www.ecshop.cx\n");
}
else
{
    //$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    //$uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile)/i";
    //if(($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']), 'wap'))
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    $uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile)/i";
    $smartuachar = "/(ipad)/i";
    //if(($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap'))
    if (!(preg_match($smartuachar, $ua)) && ($ua == '' || preg_match($uachar, $ua)) && !strpos(strtolower($_SERVER['REQUEST_URI']), 'wap'))
    {
        $Loaction = 'mobile/';
 
        if (!empty($Loaction))
        {
            ecs_header("Location: $Loaction\n");
            exit;
        }
    }
}
/* 修改 by www.ecshop.cx end */

本文原创地址:https://www.ecshop.cx/article-777.html
版权所有 © 转载时必须以链接形式注明出处!

觉得本文对您有用,想收藏下来!方法很简单:请点击-〉
我们一直坚持白天工作、晚上熬夜更新资源,付出了巨大的精力和时间,其中的辛酸难以言述。

严重提醒紧急通报,必看避免亲的损失【一直被模仿从未被超越】 充值有惊喜 ECSHOP插件网微信客服edait_cn