IntermediaryValidate.php 1.4 KB
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace api\portal\validate;

use think\Validate;

class IntermediaryValidate extends Validate
{
    protected $rule = [
        'name' => ['require','length:2,4','chs'],
        'password' => ['require','length:6,16'],
        'tel' => ['regex'=>'/13[123569]{1}\d{8}|15[1235689]\d{8}|188\d{8}/','require'],
    ];
    protected $message = [
        'name.require' => '姓名不能为空!',
        'name.length' => '姓名为2-4个汉字!',
        'name.chs' => '姓名只能是汉字!',
        'tel.require' => '手机号不能为空!',
        'tel.regex' => '手机号格式不正确!',
        'password.require' => '密码不能为空!',
        'password.length' => '密码长度为6-16位!',

    ];

    protected $scene = [
        'add'  => ['name','tel','password'],
        'edit'  => ['tel','password','name'],
    ];

}