我的應用程序在開發環境中完全正常工作。一旦我把它上傳到我的生產服務器,我得到了以下錯誤:我的默認控制器無法找到父控制器
Parse error: syntax error, unexpected T_FUNCTION, expecting ‘)’ in /home/fjamal/public_html/*/anyname/application/config/config.php on line 27
的錯誤指的是下面的代碼:
spl_autoload_register(function($class)
{
if (strpos($class, 'CI_') !== 0)
{
if (file_exists($file = APPPATH . 'core/' . $class . EXT))
{
include $file;
}
elseif (file_exists($file = APPPATH . 'libraries/' . $class . EXT))
{
include $file;
}
}
});
如果我改變了上面的代碼到舊版本:
function __autoload($class)
{
if (strpos($class, 'CI_') !== 0)
{
if (file_exists($file = APPPATH . 'core/' . $class . EXT))
{
include $file;
}
elseif (file_exists($file = APPPATH . 'libraries/' . $class . EXT))
{
include $file;
}
}
}
我得到的跟隨着克錯誤:
Fatal error: Class ‘Frontend_Controller’ not found in /home/fjamal/public_html/**/anyname/application/controllers/home.php on line 4
誤差的說明:我的控制器從Frontend_Controller駐留在庫文件夾延伸。 Frontend_Controller從駐留在覈心文件夾下的MY_Controller擴展而來。出於某種原因,在生產環境中的所有這些問題,我不明白它在我的本地主機。因此,家是默認控制器。
此錯誤阻止應用程序運行,我根本無法弄清楚它。任何幫助將不勝感激。
要麼告訴我們哪一行是第27行(並且是第1-26行),或者只是發佈'config.php'文件 - 它會將這個問題從「讀取和解決你想要的問題」轉變爲「找到致命的錯誤「,這是一個更容易的答案:P – Joe
您確實在生產配置文件中更改了base_URL?和你的.htaccess文件? –
哪個PHP版本在您的生產環境中運行? –