Study.php
704 字节
<?php
namespace app\admin\validate;
use think\Validate;
class Study extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'name'=>'require|max:15',
'phone'=>['regex:/^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/']
];
/**
* 提示消息
*/
protected $message = [
'name.require'=>'必填',
'name.max:10'=>'不能超过15个字符',
'phone' => '手机号只能为11位,且只能为13,14,15,16,17,18,19开头'
];
/**
* 验证场景
*/
protected $scene = [
'add' => ['name','phone'],
'edit' => ['name','phone'],
];
}