最小长度规则不接受Yii中的消息

Moe*_*ini 3 rule yii

Yii中的Model Rules函数中的以下代码

public function rules()
{
    // NOTE: you should only define rules for those attributes that
    // will receive user inputs.
    return array(
        array('mail, firstname, lastname, number, question, time', 'required','message'=>'{attribute} ??? ????? ???? ????'),
        array('status', 'numerical', 'integerOnly'=>true,'message'=>'{attribute} ??? ?????? ???? ???? ???'),
        array('mail, firstname, lastname, number', 'length', 'max'=>45,'message'=>'?????? ??? {attribute} ?? ?????? ?? ????'),
        array('question','length','min'=>10,'message'=>'????? ??? ???? ?? ?????? ?? ????'),
        array('mail','email','message'=>'????? ???? ??? ????? ??? ????'),
        array('time','unsafe'),
        // The following rule is used by search().
        // Please remove those attributes that should not be searched.
        array('id, mail, firstname, lastname, number, question, time, status', 'safe', 'on'=>'search'),
    );
}
Run Code Online (Sandbox Code Playgroud)

所有消息都正常工作,除了我定义的最小长度

array('question','length','min'=>10,'message'=>'????? ??? ???? ?? ?????? ?? ????'),
Run Code Online (Sandbox Code Playgroud)

它总是返回Yii的默认值,这意味着 پرسش太短(最少10个字符).

boo*_*dev 11

message使用属性当字段是通过指定一些确切长度不is属性.对于自定义最小长度消息使用tooShort属性:

array('question','length','min'=>10,'tooShort'=>'????? ??? ???? ?? ?????? ?? ????'),
Run Code Online (Sandbox Code Playgroud)