简体   繁体   English

yii2“ minHeight”规则的自定义错误消息

[英]yii2 custom error message for 'minHeight' rule

Here is my rule 这是我的规则

        [
            ['photo_1','photo_2','photo_3','photo_4','photo_5','photo_6'], 
            'image', 
            'skipOnEmpty' => true,
            'minHeight' =>  '281',
            'minWidth' =>  '281',
            'extensions' => 'png, jpg, gif',
            'wrongExtension' => 'Faqat .png, .jpg, yoki .gif formatidagi rasmlarni yuklashingiz mumkin!',
        ],

How can I write custom error message for 'minHeight' and 'minWidth' ? 如何为“ minHeight”和“ minWidth”编写自定义错误消息?

Use underHeight and underWidth keys (just like you used wrongExtension ). 使用underHeightunderWidth键(就像您使用wrongExtension )。

Available placeholders: 可用的占位符:

  • {attribute} : the attribute name {attribute} :属性名称
  • {file} : the uploaded file name {file} :上传的文件名
  • {limit} : the value of $minWidth (or $minHeight) {limit} :$ minWidth(或$ minHeight)的值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM