2
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 的控制器的一部分,一旦调用此函数,我在屏幕上看到的只是空白。

此功能是来自工作控制器的工作功能的精确副本。仅更改文件名(模型、视图)

我无法弄清楚问题出在哪里。

4

3 回答 3

7

您可以通过 enalbing 轻松检查整个环境中发生的情况CI logs

config/config.php编辑这个:

/*
|--------------------------------------------------------------------------
| 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

/logs然后,如果您的 /application 文件夹中还没有文件夹,请创建该文件夹并将其添加775 chmod到该文件夹​​(仅限日志文件夹)。

更新: 您还必须chown apache:apache logs为了让 apache 能够在该文件夹中写入。

通过浏览器运行您的应用程序并在您/logs的文件夹中检查该log.php文件,它将包含all the application errors.

于 2013-01-04T21:51:57.143 回答
4

要查看错误而不是白页,您需要更改 php.ini 文件中的两个选项:

  • error_reportingE_ALL
  • display_errorOn

有关更多信息,请参阅此答案

于 2013-01-04T21:33:26.450 回答
1

如果更改了文件名,还需要更改类名:

一个名为的文件my_class.php需要有: class My_class extends CI_Controller {

所以,如果你拿了一个工作控制器,复制它,然后重命名文件。然后你还需要重命名这个类。

于 2013-01-04T21:32:05.433 回答