FormValidate
extends Validate
in package
用于验证表单中的validate
class Customer extends \FormValidate { protected $rule = [ 'title' => 'require|max:25', 'phone' => 'require', ];
protected $message = [ 'title.require' => '名称必须', 'title.max' => '名称最多不能超过25个字符', 'phone.require' => '手机号必须', ];
protected $scene = [ 'add' => ['title','phone'], 'edit' => ['title','phone'], ];
public function form_validate_field(){ global $scrm_customer_field; return $scrm_customer_field; } }
字段配置 https://doc.thinkphp.cn/v8_0/rule_buildin.html 'rule'=>'require', 'scene'=>'add,edit', 'message'=>[ 'bro.require'=>'出生年月必须' ]
Table of Contents
Methods
- __construct() : mixed
- add_rule() : mixed
- 添加规则
- add_scene() : mixed
- 添加到验证场景
- form_validate_field() : mixed
Methods
__construct()
public
__construct() : mixed
add_rule()
添加规则
public
add_rule(mixed $name, mixed $rule) : mixed
Parameters
- $name : mixed
- $rule : mixed
add_scene()
添加到验证场景
public
add_scene(mixed $scene, mixed $field) : mixed
Parameters
- $scene : mixed
- $field : mixed
form_validate_field()
public
form_validate_field() : mixed