如何在驗證程序中添加密碼驗證規則?Laravel密碼驗證規則
驗證規則:
密碼包含至少三個以下五類的字符:
- 英文大寫字符(A - Z)
- 英文小寫字符(A - (0 - 9)
- 非字母數字(例如:!,$,#或%) 個
- Unicode字符
如何添加上述規則的驗證規則?
我的代碼這裏
// create the validation rules ------------------------
$rules = array(
'name' => 'required', // just a normal required validation
'email' => 'required|email|unique:ducks', // required and must be unique in the ducks table
'password' => 'required',
'password_confirm' => 'required|same:password' // required and has to match the password field
);
// do the validation ----------------------------------
// validate against the inputs from our form
$validator = Validator::make(Input::all(), $rules);
// check if the validator failed -----------------------
if ($validator->fails()) {
// get the error messages from the validator
$messages = $validator->messages();
// redirect our user back to the form with the errors from the validator
return Redirect::to('home')
->withErrors($validator);
}
不能將每個字符都表示爲* unicode字符*嗎? –