Codeigniter显示空白页而不是错误消息 [英] Codeigniter displays a blank page instead of error messages

查看:297
本文介绍了Codeigniter显示空白页而不是错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Codeigniter,而不是错误消息,我只是得到一个空白页。有没有办法显示PHP错误消息?当我没有收到任何反馈时,很难调试。

I'm using Codeigniter, and instead of error messages I'm just getting a blank page. Is there any way to show PHP error messages instead? It's very hard to debug when I get no feedback.

我的环境是Ubuntu的Apache。

My environment is Ubuntu with Apache.

推荐答案

由于目前没有任何解决方案能为您效劳,请尝试以下方法:

Since none of the solutions seem to be working for you so far, try this one:

ini_set('display_errors', 1);

http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors

这显式地告诉PHP 显示错误。

This explicitly tells PHP to display the errors. Some environments can have this disabled by default.

这是我的环境设置在 index.php 中的样子:

This is what my environment settings look like in index.php:

/*
 *---------------------------------------------------------------
 * APPLICATION ENVIRONMENT
 *---------------------------------------------------------------
 */
define('ENVIRONMENT', 'development');
/*
 *---------------------------------------------------------------
 * ERROR REPORTING
 *---------------------------------------------------------------
 */
if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            // Report all errors
            error_reporting(E_ALL);

            // Display errors in output
            ini_set('display_errors', 1);
        break;

        case 'testing':
        case 'production':
            // Report all errors except E_NOTICE
            // This is the default value set in php.ini
            error_reporting(E_ALL ^ E_NOTICE);

            // Don't display errors (they can still be logged)
            ini_set('display_errors', 0);
        break;

        default:
            exit('The application environment is not set correctly.');
    }
}

这篇关于Codeigniter显示空白页而不是错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆