Study.php 503 字节
<?php

namespace app\admin\validate;

use think\Validate;

class Study extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name'=>'require|/^[\u4e00-\u9fa5]{2,4}$/'
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'name.require'=>'必填',
        'name./^[\u4e00-\u9fa5]{2,4}$/'=>'只能是2-4个字符',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => [],
        'edit' => ['name'],
    ];
    
}