douyanguo7964 2012-06-27 04:23
浏览 19
已采纳

自动加载数据库库的空白页面

Possible Duplicate: Problem with database in CodeIgniter

Alright, I've googled this the last two days to no avail. I'm received a few hits from SO and codeigniter's support forums and they're mostly misleading threads and "oops" mistakes by other people. I actually have two questions, but one I can hold onto for the sake of solving this mind boggler.

My Setup:

  • FRESH CodeIgniter 2.1
  • IIS 7.5, FastCGI+PHP 5.4.4
  • Windows 7 Professional x64

Alright so,

  1. I added the following line to my "welcome" controller, before the view gets loaded. CodeIgniter spits out the "Unable to load the requested class: database". I tried "Database" too, same thing.

    $this->load->library('database');

  2. I've tried $autoload['libraries'] = array('database'); which yields a blank page.

  3. I've also tried $autoload['libraries'] = array('Database'); which yields the preview page as seen in #1.
  4. I added error_reporting(E_ALL) above the inline load from the welcome controller and nothing else showed up.

I can only come to blame my inexperience with IIS that could be causing the issue.

EDIT: So, #1 has been fixed, auto-loading database, and, thanks to Ben, I had forgotten about "load->database(...)" method...

Anyway, my current error now is just a white page when the database is loaded via autoload. My code is just set to autoload the database and display the default view provided with CodeIgniter. Removing the database autoload causes the view to show...

  • 写回答

2条回答 默认 最新

  • dongqiao5573 2012-06-27 04:29
    关注

    Your #2 option most likely worked fine, and some other unreported PHP error (check your CI logs) caused the blank page.

    To manually load the database, use $this->load->database();

    see this link for more

    library() is for custom library files.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)