1. Go to this page and download the library: Download mzh/hyperf-validate library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Mzh\Validate\Annotations\RequestValidation;
/**
* @RequestValidation(filter=true,throw=true)
*/
public function login(){
//这里取到的 $data 是安全的。
$data = $this->request->getParsedBody();
}
use Mzh\Validate\Annotations\Validation;
/**
* @Validation(mode="Admin",scene="login",field="data")
* @Validation(mode="Admin",scene="array的规则",field="array")
*/
public function login($data,$array,$array2){
//这里取到的 $data,$array,$array2 是安全的,经过验证器验证过的
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.