验证器 验证失败
$test=new Test;
$test->id='aaa';
$test->title='tltle5asdf3';
$test->validate();
if($test->hasErrors()){
echo 'duol';
exit;
}
$test->save();这个是 控制器里的代码
return [
['id','integer'],
['title','string','length'=>[0,5]]
];这个是 表里的代码
$test=new Test;
$test->id='aaa';
$test->title='tltle5asdf3';
$test->validate();
if($test->hasErrors()){
echo 'duol';
exit;
}
$test->save();这个是 控制器里的代码
return [
['id','integer'],
['title','string','length'=>[0,5]]
];这个是 表里的代码
2015-10-16
举报