Download the PHP package death_satan/thinkphp-form-request without Composer
On this page you can find all versions of the php package death_satan/thinkphp-form-request. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download death_satan/thinkphp-form-request
More information about death_satan/thinkphp-form-request
Files in death_satan/thinkphp-form-request
Download death_satan/thinkphp-form-request
More information about death_satan/thinkphp-form-request
Files in death_satan/thinkphp-form-request
Vendor death_satan
Package thinkphp-form-request
Short Description thinkphp6 form request
License MIT
Homepage https://www.cnblogs.com/death-satan
Package thinkphp-form-request
Short Description thinkphp6 form request
License MIT
Homepage https://www.cnblogs.com/death-satan
Keywords thinkphp6thinkphp composer组件扩展包
Please rate this library. Is it a good library?
Informations about the package thinkphp-form-request
thinkphp6 FormRequest 扩展
参考laravel的表单验证
安装
创建验证器
默认生成的是一个基础表单验证器,类文件如下
结合validate验证器使用
生成验证器 Test
再生成一个表单验证器
修改表单验证器中的validate属性
在控制器中使用
不与validate结合
重写 rules messages方法 以及batch属性
验证
验证失败
- form验证器验证失败的话会进行判断,如果是ajax请求那将会返回一个JsonResponse对象
-
如果不是ajax则会返回一个redirect到上一页,并且在session内写入 键名errors的错误消息,以便调用
接管自定义验证
-
在生成的form request验证器内重写 withValidate 方法
- 其实就是参考laravel的表单验证用tp结合validate写了一个
- 目的是把数据验证和业务处理分离出来
- 会laravel的话应该很容易上手
All versions of thinkphp-form-request with dependencies
PHP Build Version
Package Version
The package death_satan/thinkphp-form-request contains the following files
Loading the files please wait ....