Validator验证中文长度的问题
[phpcode]
$info = [
'value' => '新栏目',
'type' => '0',
'sort' => '0'
];
$rule = [
'value' => 'digits_between:3,30|required',
'type' => 'required|numeric',
'sort' => 'required|numeric'
];
$this->validator = Validator::make($info,$rule);
if ($this->validator->fails()){
$this->validator->messages();die();
return false;
}
return true;
[phpcode]
我也不知道以上代码有什么问题,结果:{"value":["The value must be between 3 and 30 digits."]}
utf-8编码,崩溃!
$info = [
'value' => '新栏目',
'type' => '0',
'sort' => '0'
];
$rule = [
'value' => 'digits_between:3,30|required',
'type' => 'required|numeric',
'sort' => 'required|numeric'
];
$this->validator = Validator::make($info,$rule);
if ($this->validator->fails()){
$this->validator->messages();die();
return false;
}
return true;
[phpcode]
我也不知道以上代码有什么问题,结果:{"value":["The value must be between 3 and 30 digits."]}
utf-8编码,崩溃!
0 个回复