致命错误:调用未定义的方法CI_DB_pdo_driver :: where() [英] Fatal error: Call to undefined method CI_DB_pdo_driver::where() in
问题描述
我正在使用PDO驱动程序来访问MySQL数据库.在那部分,一切都正常.我的database.php看起来像这样:
I’m using PDO driver to access MySQL database. Everything is working OK on that part. My database.php looks like this:
$active_group = 'default';
$active_record = FALSE;
$db['default']['hostname'] = 'mysql:host=127.0.0.1:3386';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'mydatabase';
$db['default']['dbdriver'] = 'pdo';
$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;
我不使用Active Record.
I don’t use Active Record..
当我自动加载会话库并将其设置为使用数据库时,出现了问题.我在数据库中创建了表,并且在第一次访问站点时,一条记录被插入到会话表中.没问题. 后续访问该站点时发生错误.我正在关注:
The problem occurred when I auto-loaded session library and set it to use database. I created table in my database, and on first visit to site, a record gets inserted into session table. No problem there. An error occurs on subsequent visits to the site. I’m getting following:
Fatal error: Call to undefined method CI_DB_pdo_driver::where() in P:\Git\TengWebsite\system\libraries\Session.php on line 201
推荐答案
set $ active_record = TRUE;
set $active_record = TRUE;
$active_group = 'default';
$active_record = TRUE;
注意:某些CodeIgniter类(例如会话)要求启用Active Record才能访问某些功能.
在此处明确声明 CodeIgniter文档
这篇关于致命错误:调用未定义的方法CI_DB_pdo_driver :: where()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!