<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_52099"> <div class="blockcode"> <div id="code_M11"><ol> <li>$transaction=Yii::app()->db->beginTransaction();</li> <li>try{</li> <li>$model1->save();</li> <li>$model2->save();</li> <li>$model3->save();</li> <li>$model4->save();</li> <li>$model5->save();</li> <li>出错</li> <li>$model6->save();</li> <li>$transaction->commit();</li> <li>}</li> <li>catch(Exception $e){</li> <li>$transaction->rollBack();</li> <li>}</li> <li>model1 , model2 , model3 , model4 , model5 照样存储成功! </li> </ol></div> <em onclick="copycode($('code_M11'));">复制代码</em> </div> </td></tr></table> <div id="comment_52099" class="cm"> </div> <div id="post_rate_div_52099"></div> <br><br>