升级到新的PHP7服务器后的无休止循环

升级到新的PHP7服务器后的无休止循环,php,mobile,Php,Mobile,我使用此代码将移动用户重定向到我的移动站点 $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(

我使用此代码将移动用户重定向到我的移动站点

$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'))
{
    $Loaction = 'mobile/';
    if (!empty($Loaction))
    {
        ecs_header("Location: $Loaction\n");
        exit;
    }
}
domain.com/mobile

最近我用PHP7将我的服务器移到了云服务器上,现在我开始面临的问题是,当移动设备访问该站点时,会出现这样的无休止的循环

domain.com/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile/

有人能帮我一下吗?或者给我指一下正确的方向


谢谢

您还必须检查
$\u服务器['REQUEST\u URI']
是否以
/mobile
开头。例如:

if (($ua == '' || preg_match($uachar, $ua)) &&
    strpos($requestUri, '/wap') === false &&
    strpos($requestUri, '/mobile') === false
) {
    $location = 'mobile/';
    header("Location: $location");
    exit;
}

如果$ua为空,或者与$uachar匹配,并且不包含“wap”
对吗?
$ua
通常包含哪些内容,在手机上包含哪些内容?欢迎使用StackOverflow!这并不能回答这个问题。一旦你有足够的钱,你将能够;相反,提供答案。另外,是一个非常有用的资源!