PHP code example of luohonen / validate
1. Go to this page and download the library: Download luohonen/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/ */
luohonen / validate example snippets
$data = [
'name' => 'name',
'age' => 18,
'email' => '[email protected]'
];
validate($data, \app\index\validate\UserValidate::class . '.login');
namespace app\index\validate;
use Luohonen\Validate\Validate;
class UserValidate extends Validate
{
protected $rule = [
'name' => '=> '名称必须',
'name.max' => '名称最多不能超过25个字符',
'age.