如何捕获到 $this->load->database($config); 的失败
动态load一个database的时候 如果用户名 密码不符合.. 如何判断呢.$config['hostname'] = "localhost";
$config['username'] = "myusername";
$config['password'] = "mypassword";
$config['database'] = "mydatabase";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";
$config['dbcollat'] = "utf8_general_ci";
$this->load->database($config);
应该是无法捕获。。。
你可以修改下源码,呵呵 自己尝试成功
$this->load->database($config); 此方法会返回boolean类型。 但是要主要把 db_debug 设置为false。
页:
[1]