Codeigniter,空白页,没有错误 [英] Codeigniter, blank page, no errors

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

问题描述

  public function newreg()
{
$ username = $ this-> input-> post('username');
$ password = $ this-> input-> post('password');

$ this-> load-> model('register_model');

$ data ['list'] = $ this-> register_model-> add($ username,$ password);

$ this-> load-> view('register_display',$ data);
}

这是一个名为register.php
的控制器的一部分函数被调用,我在屏幕上看到的都是空格。



这个函数是一个工作控制器的一个完整的副本。只有文件名改变(模型,视图)



我不知道问题出在哪里。

解决方案

您可以通过激活 CI日志


$ b来轻松检查Enteire Envoirment中发生的情况$ b

转到 config / config.php 并编辑:

  / * 
| ---------------------------------------- ----------------------------------
|错误记录阈值
| ------------------------------------------ --------------------------------
|
|如果已启用错误日志记录,则可以将错误阈值设置为
|确定什么被记录。阈值选项是:
|您可以通过将阈值设置为零来启用错误日志记录。
|阈值确定什么被记录。阈值选项是:
|
| 0 =禁用日志记录,错误日志记录TURNED OFF
| 1 =错误消息(包括PHP错误)
| 2 =调试消息
| 3 =参考消息
| 4 =所有消息
|
|对于活动网站,您通常只会启用错误(1)记录,否则
|您的日志文件将填满非常快。
|
* /


$ config ['log_threshold'] = 0; // put this to 4

那么如果你还没有一个 / logs 文件夹中,创建它,并添加 775 chmod (仅日志文件夹)。



UPDATE:您还必须 chown apache:apache logs ,以便apache能够在

通过浏览器运行您的应用程序,并在 / logs 文件夹中查找 log.php 文件,它将包含所有应用程序错误


public function newreg()
    {
        $username = $this->input->post('username');
        $password = $this->input->post('password');

        $this->load->model('register_model');

        $data['list']=$this->register_model->add($username, $password);

        $this->load->view('register_display', $data);
    }

This is part of a controller named register.php once this function gets called, all I see on the screen is white space.

This function is an exact copy of a working one, from a working controller. Only the file names are changed (model, view)

I can't figure out where the problem is.

解决方案

You can easly check what's happening in the enteire envoirment by enalbing CI logs,

go to config/config.php and edit this:

/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
|   0 = Disables logging, Error logging TURNED OFF
|   1 = Error Messages (including PHP errors)
|   2 = Debug Messages
|   3 = Informational Messages
|   4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/


  $config['log_threshold'] = 0; //put this to 4

then if you have not yet a /logs folder inside your /application folder, create that and add 775 chmod to that (logs folder only).

UPDATE: You must also chown apache:apache logs in order for apache to be able to write within that folder.

run your application by the browser and check inside your /logs folder the log.php file, it will contain all the application errors.

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

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