加载数据库时的Codeigniter空白页

时间:2015-11-20 00:04:21

标签: php codeigniter

所以在搜索stackoverflow之后,决定写下这个问题。

这次我正在Godaddy的托管cPanel计划上工作。 上传了一个干净的Application showing de-DE resources in DocumentViewer包,欢迎消息显示应该。 我使用url和database.php配置了config.php和正确的连接数据。 到现在为止,一切都按预期工作。 因此,在加载数据库之后,如果我刷新页面,看看是否所有内容都是双向的,并且出现“死屏幕”。

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

    /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     *      http://example.com/index.php/welcome
     *  - or -  
     *      http://example.com/index.php/welcome/index
     *  - or -
     * Since this controller is set as the default controller in 
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/welcome/<method_name>
     * @see http://codeigniter.com/user_guide/general/urls.html
     */
    public function index()
    {
        $this->load->database();
        $this->load->view('welcome_message');
    }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */

所以在搜索它中断的地方之后,我在第300行中找到了/system/core/Codeigniter.php。在$ CI = new $ class()之前中断;

/*
 * ------------------------------------------------------
 *  Instantiate the requested controller
 * ------------------------------------------------------
 */
    // Mark a start point so we can benchmark the controller
    $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
    $CI = new $class();

在日志文件中,返回此行

DEBUG - 2015-11-19 20:57:31 --> Config Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Hooks Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Utf8 Class Initialized
DEBUG - 2015-11-19 20:57:31 --> UTF-8 Support Enabled
DEBUG - 2015-11-19 20:57:31 --> URI Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Router Class Initialized
DEBUG - 2015-11-19 20:57:31 --> No URI present. Default controller set.
DEBUG - 2015-11-19 20:57:31 --> Output Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Security Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Input Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Global POST and COOKIE data sanitized
DEBUG - 2015-11-19 20:57:31 --> Language Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Loader Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Helper loaded: url_helper
DEBUG - 2015-11-19 20:57:31 --> Helper loaded: html_helper
DEBUG - 2015-11-19 20:57:31 --> Helper loaded: cms_helper
DEBUG - 2015-11-19 20:57:31 --> Helper loaded: drops_helper
DEBUG - 2015-11-19 20:57:31 --> Controller Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Model Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Model Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Helper loaded: form_helper
DEBUG - 2015-11-19 20:57:31 --> Database Driver Class Initialized

我需要部署在其他服务器上制作的网页,当我在Godaddy中上传时,会出现空白页面,这就是我上传一个干净的Codeigniter包的原因。 有人可以帮帮我吗? 提前谢谢。

EDIT 忘了在index.php上写错误报告

define('ENVIRONMENT', 'development');

if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            ini_set('display_errors',1);
            error_reporting(E_ALL);
        break;

        case 'testing':
        case 'production':
            error_reporting(0);
        break;

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

1 个答案:

答案 0 :(得分:0)

在application / config / autoload.php中加载数据库,如下所示:

$autoload['libraries'] = array('database');

从文件中删除以下行:

$this->load->database();