在类DataBase中,我有方法选择
public function select($sql,$tab){
try {
$this->req=$this->getPDO()->prepare($sql);
$this->req->execute($tab);
$result =$this->req->fetchAll(PDO::FETCH_CLASS);
} catch (\Exception $e) {
// We got an exception == table not found
$result=false;
}
return $result;
}
如果在数据库中找不到表但是它不起作用,我想捕获异常。