我试图在我的CodeIgniter(2.2.0)应用程序中使用PDO MySQL驱动程序,但我不知道为什么会出现此错误。 这是我的数据库配置:
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'mysql:host=localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'mydbname';
$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;
调用堆栈
# Time Memory Function Location
{main}( ) ..\index.php:0
require_once( 'D:\wamp\www\CodeIgniter_2.2.0\system\core\CodeIgniter.php' ) ..\index.php:202
3 0.0279 1142584 Login->__construct( ) ..\CodeIgniter.php:308
4 0.0279 1142584 CI_Controller->__construct( ) ..\Login.php:15
5 0.0308 1338688 CI_Loader->initialize( ) ..\Controller.php:51
6 0.0308 1338664 CI_Loader->_ci_autoloader( ) ..\Loader.php:152
7 0.0467 2338736 CI_Loader->library( ) ..\Loader.php:1178
8 0.0467 2338920 CI_Loader->_ci_load_class( ) ..\Loader.php:216
9 0.0487 2471440 CI_Loader->_ci_init_class( ) ..\Loader.php:975
10 0.0492 2473816 CI_Session->__construct( ) ..\Loader.php:1099
11 0.0521 2574776 CI_Session->sess_read( ) ..\Session.php:106
12 0.0541 2580216 CI_DB_active_record->get( ) ..\Session.php:229
13 0.0542 2582224 CI_DB_driver->query( ) ..\DB_active_rec.php:963
14 0.0566 2670472 CI_DB_pdo_result->num_rows( ) ..\DB_driver.php:386
我的默认控制器是Login.php:
class Login extends CI_Controller{
function __construct()
{
parent::__construct();
}
function index(){
echo 'hello';
}
答案 0 :(得分:0)
我找到了this bug reported against CodeIgniter 2.2.0。
建议的修复方法是避免CodeIgniter中的PDO驱动程序,或升级到CodeIgniter 3.0。