php CodeIgniter 错误:变量引用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30785717/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 22:04:03  来源:igfitidea点击:

CodeIgniter Error: variable references

phpcodeignitercodeigniter-3

提问by Kiran Vemula

I've deployed my source code in XAMPP. I'm getting following errors.

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

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

注意:在 C:\xampp\htdocs\3c_app\public_html\system\core\Common.php 第 257 行
致命错误:Class 'CI_Controller' not found in C:\xampp\htdocs\3c_app 中,只应通过引用返回变量引用\public_html\system\core\CodeIgniter.php 在第 233 行。

My source files are:

我的源文件是:

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;
}

line 257 is: return $_config[0] =& $config;and

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

Codeigniter.php

代码点火器.php

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

    require($file_path);

line 233: if ( ! file_exists($file_path))

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

Can any one help???

有人可以帮忙吗???

回答by aiai

Try this one:

试试这个:

Change it in your Common.php

在您的 Common.php 中更改它

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

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

See also here , for more reference : Only variable references should be returned by reference - Codeigniter. I hope this helps.

另请参阅此处以获取更多参考:仅变量引用应通过引用返回 - Codeigniter。我希望这有帮助。

回答by Abdulla Nilam

In Common.phpChange this

Common.php 里改这个

return $_config[0] =& $config;

to this

对此

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

Problem is with assigning and returning data.

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

回答by vijay kant sharma

If your code is still not working, then try this.

如果您的代码仍然无法正常工作,请尝试此操作

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

回答by Karthik SWOT

Codeigniter itself fixed that error now.

Codeigniter 本身现在修复了这个错误。

You just update current updated version of Codeigniter in here.

您只需在此处更新 Codeigniter 的当前更新版本。

It will solve your error.

它将解决您的错误。