驗證器 驗證失敗
$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
舉報
2016-01-19
...不驗證失敗才不正常吧。。。沒看到長度限制和類型限制么