public function actionInsert() { //Test->实例obj对象->save方法转化为数据->db $test = new Test(); $test->id = 'bbbb'; $test->title = "*****@*****.**"; $test->validate(); if ($test->hasErrors()) { echo 'error'; die; } $test->save(); }