|
问题:在创建、更新、删除数据时,若出现数据库异常,希望在Exception里面捕捉到
$model = new IroboxWarehouse();
try{
$model->db->transStart();
$status = $model->insert($data);
$model->db->transComplete();
} catch(Exception $e) {
$model->db->transRollback();
echo date('Y-m-d H:i:s - '), str_replace(ROOTPATH, '', __FILE__), ', Line:', __LINE__, ' --- <pre>', PHP_EOL, var_dump($e->getMessage()), PHP_EOL;
}
|
|