1)通过autoload.PHP
$autoload['libraries'] = array('database');
2)内部控制器通过
$this->load->library("database");
要么
$CI =& get_instance();
$CI->load->database();
环境:CodeIgniter 2.1.3,IIS 5.2(ISAPI)上的PHP 5.2.13,MysqL(5.0.45-community-nt),Plesk.
一旦删除此库,我就可以看到该页面.我能够加载其他库,如session和我的自定义库.我缺少什么想法?
这是我的数据库配置设置:
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'username';
$db['default']['password'] = 'password';
$db['default']['database'] = 'databasename';
$db['default']['dbdriver'] = 'MysqL';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
解决方法:
您可以检查服务器日志,也可以通过config.PHP启用CI日志
/*
|--------------------------------------------------------------------------
| 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'] = 4;
将值设置为4并检查/ application文件夹中是否有775 chmod / logs目录,如果没有创建,CI将自动在该目录中创建日志文件.
你将能够以这种方式检查任何CI错误
正如您从日志文件中报告的那样
更改,/ config目录下的database.PHP第50行:
$db['default']['pconnect'] = TRUE;
至
$db['default']['pconnect'] = FALSE;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。