【发布时间】:2014-02-17 08:58:18
【问题描述】:
我正在使用mobiledetect 将移动用户重定向到特定页面。但是,当我写这篇文章时,我收到了redirect() 的致命错误。谁能让我知道我在哪里以及缺少什么?
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
$scriptVersion = $detect->getScriptVersion();
if ($detect->isMobile())
redirect('iammobile.php');
else
echo '<h1>I am Desktop</h1>';
【问题讨论】:
-
redirect()不是函数。错误相当明显。你在哪里创建这个功能?你真的想要header()函数吗? -
看到这个问题有很多选择:stackoverflow.com/questions/768431/…
-
这意味着它无法在任何地方找到名称为
redirect的函数。尝试改用header("Location:iammobile.php")