我使用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>';
添加
$autoload['helper'] = array('url', 'form');
'重定向()'是不是一個函數。錯誤相當清楚。你在哪裏創建這個功能?你真的想要[[header()'](http://uk3.php.net/manual/en/function.header.php)函數嗎? – naththedeveloper見很多的選擇這個問題:http://stackoverflow.com/questions/768431/how-to-make-a-redirect-in-php –
這意味着它無法找到一個名稱的函數'重定向'隨時隨地。嘗試使用'header(「Location:iammobile.php」)'代替 – asprin