CodeIgniter错误:变量引用

时间:2015-06-11 15:54:57

标签: php codeigniter codeigniter-3

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

  

注意:在第257行的C:\ xampp \ htdocs \ 3c_app \ public_html \ system \ core \ Common.php中,只能通过引用返回变量引用。   致命错误:第233行的C:\ xampp \ htdocs \ 3c_app \ public_html \ system \ core \ CodeIgniter.php中找不到类“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))

任何人都可以帮忙???

4 个答案:

答案 0 :(得分:39)

试试这个:

在Common.php中更改

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

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

另请参阅此处,以获取更多参考:Only variable references should be returned by reference - Codeigniter。我希望这会有所帮助。

答案 1 :(得分:15)

Common.php 更改此

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

到这个

npm dedupe

问题在于分配和返回数据。

答案 2 :(得分:2)

如果您的代码仍无效,请试试

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

答案 3 :(得分:0)

Codeigniter本身现在已修复该错误。

您只需在here中更新Codeigniter的当前更新版本。

它将解决您的错误。

相关问题