我有CodeIgniter 3.0.0,托管在1and1.com上,使用的是PHP 5.5。我正在工作的网站过去一直是在我上一次工作。今天,我尝试加载该网站,然后看到(删除了部分路径以不显示我的用户信息):
Parse error: syntax error, unexpected T_ARRAY, expecting ')' in /htdocs/_smchorus/system/core/Common.php on line 238
我唯一能想到的可能是更改,是我记得最近在1and1.com管理面板上从php 5.4迁移到5.5。我不确定为什么会破坏它。我还没有真正搞清楚codeigniter的系统代码。我尝试回到5.4,但并没有解决。
这行:
function get_config(Array $replace = array())
是第238行有问题。
if ( ! function_exists('get_config'))
{
/**
* Loads the main config.php file
*
* This function lets us grab the config file even if the Config class
* hasn't been instantiated yet
*
* @param array
* @return array
*/
function get_config(Array $replace = array())
{
static $config;
if (empty($config))
{
$file_path = APPPATH.'config/config.php';
$found = FALSE;
if (file_exists($file_path))
{
$found = TRUE;
require($file_path);
最佳答案
您可能不小心将php设置为较旧的版本。尝试在index.php
的顶部添加以下内容,以检查实际上是否使用了正确的版本。
echo phpversion(); die();
该错误似乎不在配置中或其他任何内容中。它说它是分析错误,因此关键字
Array
必须引起了问题。而且旧版本的php无法识别此语法。因此检查。
关于php - Codeigniter突然停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32514089/