我正在使用Zend框架1.12.我有一个基于ajax的UI,它将用户帐户信息(存储在master数据库中)发送到控制器。每个用户帐户都有其相关的DB。但是当我选择没有相关数据库的用户时,控制器会发送应用程序错误。我希望将一些消息发送到UI。
private function _initDB()
{
global $databaseip, $username, $password;
try {
// I can access this scope with valid db name
// for multi user && multi db
$this->_pdo = new Zend_Db_Adapter_Pdo_Mysql(
array(
'host' => $databaseip,
'username' => $username,
'password' => $password,
'dbname' => $this->_dbname,
)
);
} catch (Zend_Exception $e) {
// I want some message to be passed to UI.
// can't access this scope with invalid dbname
// as users list stores in master database
// may be db-admin deleted database of that user
// but forgot to delete that user from master-users database
}
}
提前致谢: