CodeIgniter Error: variable references

CodeIgniter Error: variable references

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

Notice: Only variable references should be returned by reference in C:\xampp\htdocsc_app\public_html\system\core\Common.php on line 257
Fatal error: Class 'CI_Controller' not found in C:\xampp\htdocsc_app\public_html\system\core\CodeIgniter.php on line 233.

我的源文件是:

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))

谁能帮忙???

试试这个:

在您的 Common.php

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

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

另请参阅此处,以获取更多参考:。希望对您有所帮助。

Common.php中更改此

return $_config[0] =& $config;

至此

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

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

如果您的代码仍然无法正常工作,那么试试这个

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

Codeigniter 本身现已修复该错误。

您刚刚在 here 中更新了 Codeigniter 的当前更新版本。

它将解决您的错误。