TP自动验证密码范围

Posted camg

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TP自动验证密码范围相关的知识,希望对你有一定的参考价值。

验证规则

$validate = new Validate(
            [
            ‘user_name‘ => ‘require|mobile‘,
            ‘password‘ => ‘require|max:16|min:8‘,
            ‘verify_code‘ => ‘require‘,
            ‘type‘ => ‘number|between:0,1‘,
            ],
            [‘phone.require‘ => ‘手机号必填‘,
            ‘phone.mobile‘ => ‘手机号格式错误‘,
            ‘password.require‘ => ‘密码不能为空‘,
            ‘password.max‘ => ‘密码设置8-16之间‘,
            ‘password.min‘ => ‘密码设置8-16之间‘,
            ‘verify_code.require‘ => ‘验证码不能为空‘,
            ‘type.between‘ => ‘在0和1之间‘,
            ]
        );

验证方法

        if (!$validate->check($request->post())) {
            $this->apiResult(CustomError::OPERATION_SUCCSESS, [], $validate->getError());
        }

 

以上是关于TP自动验证密码范围的主要内容,如果未能解决你的问题,请参考以下文章

tp框架表单验证 及ajax

TP6.0中的密码验证逻辑验证器的使用

tp5 wherein 怎么查

自动登录TP-LINK路由器,获取所有信息,重启等等,实用方法

TP表单验证

6月17 表单验证