PHP code example of sing / validate

1. Go to this page and download the library: Download sing/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/ */

    

sing / validate example snippets


\sing\validate\Validate::make(
    [
        ['domain', function ($value) {
            return $value > 100;
        }, '域名不能为空', 3 ]
	]);
//闭包返回 true 时验证通过

\sing\validate\Validate::extend('checkUser',function($field,$value,$params){
	//返回值为true时验证通过
		return true;
});

if(\sing\validate\Validate::fail()){
	echo '验证失败';
};

\sing\validate\Validate::make(array(
        array('username','