TP5 验证器内置规则中max 如果输入中文 验证错误

浏览:2420 发布日期:2017/06/28 分类:ThinkPHP5专区 关键字: 验证器 TP
验证器 中需要验证最大字符数,例如
protected $rule = [
'name' => 'require|max:50',
'sort' => 'number|max:10',
'status' => 'number|between:0,1|length:1',
];
protected $message = [
'name.require' => '分类名称必须填写',
'name.max' => '分类名称最多不能超过50个字符',
'sort.number' => '信息排序必须为数字',
'sort.max' => '信息排序最多不能超过10个字符',
'status.number' => '信息状态必须为数字',
'status.between' => '信息状态必须为0或1',
'status.length' => '信息状态必须为1个字符',
];

'name' => 'require|max:50', 已经定义最大50个字符
但是输入中文的时候 不到20个字符就说字符超过了50,有什么办法解决吗? 还是官方BUG。
最佳答案
评论() 相关
后面还有条评论,点击查看>>