【问题标题】:Codeigniter, blank page, no errors [closed]Codeigniter,空白页,没有错误[关闭]
【发布时间】:2013-01-04 21:29:11
【问题描述】:
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 的控制器的一部分 一旦调用了这个函数,我在屏幕上看到的都是空白。

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

我不知道问题出在哪里。

【问题讨论】:

  • 您尝试访问的网址是什么?你删除了 index.php 吗?
  • 网址看起来像www。 IRRELEVANT.com/index.php/register/
  • @Ivan - 很高兴我们可以访问一个免费的网站,并从其他免费提供自己时间的人那里寻求免费的建议,但我们仍然可以通过我们的嘲讽变得粗鲁厘米。祝你好运!
  • 那么也许 www.example.com 会比讽刺的“IRRELEVANT”评论更好 - 请注意@Badaboooooom 没有提供更多帮助?这可能就是原因。
  • 是的有点粗鲁,只是我不介意因为我不是英语,但我想对于英语母语,IRRILEVANT 太粗鲁了,保持安静;)

标签: codeigniter controller


【解决方案1】:

您可以通过启用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

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

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

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

【讨论】:

  • 我按照你的建议做了。我将该设置设置为数字 4,从 0 开始。日志文件夹已经存在,我只更改了权限。运行我的应用程序后,没有 logs.php 文件。
  • 你也检查过php日志吗?
【解决方案2】:

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

  • error_reportingE_ALL
  • display_errorOn

更多信息请参见this answer

【讨论】:

    【解决方案3】:

    如果你改变了文件名,你也需要改变类名:

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

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

    【讨论】:

    • 是的,然后我会说打开错误报告(会认为你也尝试过)
    • 错误报告已开启,在此之前我已经能够看到很多错误。我从来没有把它关掉。
    猜你喜欢
    • 2023-03-04
    • 1970-01-01
    • 1970-01-01
    • 2011-04-16
    • 2014-08-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-11
    相关资源
    最近更新 更多