CodeIgniter 2.X 于 PHP5.6 兼容错误

本篇文章由:http://xinpure.com/codeigniter-2-x-to-php5-6-compatible-error/

CI 3.0 已兼容此问题

在代码迁移的过程中,遇到了一个 PHP 版本兼容错误

A PHP Error was encountered

Severity: Notice

Message: Only variable references should be returned by reference

Filename: core/Common.php

Line Number: 257

原服务器 PHP 版本为 5.4,新服务器 PHP 版本为 5.6, Codeigniter 版本 2.1.3

解决方法网上比较多,在这记录下,做个笔记。

主要原因: 此错误主要出现在 Codeigniter 2.x 使用 PHP 5.6 以上的版本

解决方法:

  1. 降级 PHP 版本到 5.5 以下

  2. 修改 /system/core/Common.php 第257行代码

将:

return $_config[0] =& $config;

改成:

$_config[0] =& $config; return $_config[0];
原文地址:https://www.cnblogs.com/xinpureZhu/p/4765908.html