[英]is try/catch in php always working fine?
i try to handle exception and write code as follows but i also get exception when document save sucessfully in my databse. 我尝试处理异常并编写如下代码,但是当我的数据库中文件保存成功时,我也会遇到异常。
$table = "MyRequestTable";
$smsID = new MongoId();
$data = array("_id" => $smsID,
"requestUserid" => 2500,
"requestDate" => new MongoDate(strtotime(date('Y-m-d H:i:s'))),
"requestNosSms" => 1
);
try
{
$result = $table->insert($data, array("safe" => TRUE));
echo $smsID ;
}
catch (Exception $e)
{
echo $e->getMessage();
}
i got following exception "Invalid modifier specified: $push" 我得到以下异常“指定的无效修饰符:$ push”
Even if INSERT
command executed correct may be situation when some other instruction throws exception. 即使INSERT
命令执行正确,也可能是某些其他指令抛出异常的情况。 Are you sure that other parts of code are correct? 您确定代码的其他部分是否正确?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.