PHP Codeigniter更改system/core/common.PHP后出现空白白色屏幕


PHP Codeigniter Blank White screen after change system/core/common.php

首先,我的网页返回空白的白色屏幕,在将error_reporting(E_ALL);添加到index.php后,出现错误:

A PHP Error was encountered
Severity: Notice
Message: Only variable references should be returned by reference
Filename: core/Common.php
Line Number: 257

然后,使用这个建议,我在第257行更改system/core/common.php文件。但更改后,我的网络恢复为空白屏幕

请帮我解决这个问题。。。

仅供参考,我的index.php:

define('ENVIRONMENT', 'production');
if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            error_reporting(E_ALL);
            ini_set('display_errors', 1);
        break;
        case 'testing':
        case 'production':
            error_reporting(E_ALL);
        break;
        default:
            exit('The application environment is not set correctly.');
    }
}

我尝试过将环境改为开发,但仍然面临着空白屏幕。。。

试试这个。但是,您应该按照自己的要求更改环境常数,而不是这样做。如果要显示错误,请将define('ENVIRONMENT', 'production');更改为define('ENVIRONMENT', 'development');

switch (ENVIRONMENT)
{
    case 'development':
        error_reporting(-1);
        ini_set('display_errors', 1);
    break;
    case 'testing':
    case 'production':
        error_reporting(-1);
        ini_set('display_errors', 1);
    break;
    default:
        exit('The application environment is not set correctly.');
}

试试这个

Edit filename: core/Common.php, line number: 257
Before
return $_config[0] =& $config; 
After
$_config[0] =& $config;
return $_config[0]; 

我也遇到过类似的问题,并修改了system/core/common.php的第257行。如果下面没有提到,请将其更改为

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

只有变量引用才能通过引用返回-Codeigniter

Codeigniter显示一个空白页面,而不是错误消息

这是Codeigniter的默认设置保持原样

if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            error_reporting(E_ALL);
        break;
        case 'testing':
        case 'production':
            error_reporting(0);
        break;
        default:
            exit('The application environment is not set correctly.');
    }
}

您所要做的就是,在define('ENVIRONMENT', 'XYZ');中,您可以根据自己的目的改变环境

  1. 开发-显示系统错误,适合开发人员
  2. 测试-这是为了测试
  3. 生产-这是网站直播/托管的时候。因此,视图中不会出现错误。跳过所有内容,平稳运行

error_reporting(E_ALL);存在时,无需设置ini_set('display_errors', 1);。Bcz它还显示所有错误

因此,production中的不设置error_reporting(E_ALL);。Bczproduction用于托管站点