Validator needs to verify the maximum number of characters, such as
protected $rule = [ 'name' => 'require|max:50' ]; protected $message = [ 'Name.require' => 'classification must fill in the name of' 'Name.max' => 'category name can not exceed 50 characters' ];
'Name' => 'require | max: 50', have defined a maximum of 50 characters, but when the input Chinese characters say less than 20 characters in more than 50
Solution:
Modifying the underlying VALIDATE class thinkphp \ library \ think \ validate.php method of adding MAX UTF8 parameter, $ length = mb_strlen ((string) $ value, 'utf8');