CodeIgniter错误:变量引用

14

我已经在XAMPP中部署了我的源代码。我遇到了以下错误:

注意:C:\xampp\htdocs\3c_app\public_html\system\core\Common.php的第257行应该只返回变量引用
致命错误:在C:\xampp\htdocs\3c_app\public_html\system\core\CodeIgniter.php的第233行找不到类'CI_Controller'。

我的源文件包括:

Common.php

// Are any values being dynamically replaced?
    if (count($replace) > 0)
    {
        foreach ($replace as $key => $val)
        {
            if (isset($config[$key]))
            {
                $config[$key] = $val;
            }
        }
    }

    return $_config[0] =& $config;
}

第257行代码是:return $_config[0] =& $config;

Codeigniter.php

// Fetch the config file
    if ( ! file_exists($file_path))
    {
        exit('The configuration file does not exist.');
    }

    require($file_path);

第233行: if ( ! file_exists($file_path))

有人能帮忙吗???


你不应该更改核心文件。是哪个应用程序代码导致了这个错误?你能否编辑你的问题并发布导致错误的应用控制器代码? - Tpojka
可能是仅应返回变量引用 - Codeigniter的重复问题。 - MGP
4个回答

42

试试这个:

在你的Common.php里进行修改。

if (count($replace) > 0){
    foreach ($replace as $key => $val){
        if (isset($config[$key])){
            $config[$key] = $val;
        }
    }
}

$_config[0] =& $config;
return $_config[0];

另请参阅这里了解更多相关信息。希望能对你有所帮助。


16

Common.php 中更改此处。

return $_config[0] =& $config;

到这里

$_config[0] =& $config;
return $_config[0];

问题在于数据的赋值和返回。


2
如果您的代码仍然无法正常工作,那么请尝试以下方法
$_config[1]=& $config;
return $_config[0];

这导致出现了一个 PHP 错误 严重程度: 注意消息: 未定义的索引: subclass_prefix文件名: core/CodeIgniter.php行号: 237 - Marcelo Agimóvel

0

Codeigniter本身已经修复了这个错误。

您只需在这里更新当前的Codeigniter版本。

这将解决您的错误。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接