【问题标题】:CodeIgniter Error: variable referencesCodeIgniter 错误:变量引用
【发布时间】:2015-08-27 10:32:45
【问题描述】:

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

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

谁能帮忙???

【问题讨论】:

标签: php codeigniter codeigniter-3


【解决方案1】:

试试这个:

在您的 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。我希望这会有所帮助。

【讨论】:

    【解决方案2】:

    Common.php 更改此

    return $_config[0] =& $config;
    

    到这里

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

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

    【讨论】:

      【解决方案3】:

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

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

      【讨论】:

      • 这将导致:“遇到 PHP 错误严重性:通知消息:未定义索引:subclass_prefix 文件名:core/CodeIgniter.php 行号:237”
      【解决方案4】:

      Codeigniter 现在自己修复了这个错误。

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

      它会解决你的错误。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-06-02
        • 2015-06-07
        • 1970-01-01
        相关资源
        最近更新 更多