在我的controllers文件夹中,我有一个文件Migrate.php,其中包含以下方法:
function drop_db($db_name){
if ($this->dbforge->drop_database($db_name))
{
echo "Database {$db_name} deleted!";
}
}
调用时我需要删除数据库,但是我收到以下错误:
An uncaught Exception was encountered
Type: ErrorException
Message: pg_query(): Query failed: ERROR: cannot drop the currently open database
我尝试在方法开头使用$this->db->close();
关闭连接,但我仍然遇到同样的错误!