$m
=D(
'YourModel'
);
//或者是M();
$m2
=D(
'YouModel2'
);
$m
->startTrans();
//在第一個模型裏啓用就能夠了,或者第二個也行
$result
=
$m
->where(
'刪除條件'
)->
delete
();
$result2
=m2->where(
'刪除條件'
)->
delete
();
if
(
$result
&&
$result2
){
$m
->commit();
//成功則提交
}
else
{
$m
->rollback();
//不成功,則回滾
}