PHP code example of chendujin / validator

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

    

chendujin / validator example snippets


$mobilephone = '123456';
$res = Validator::is_mobilephone($mobilephone);
var_dump($res);

$email = '[email protected]';
$res = Validator::is_email($email);
var_dump($res);

$qq = '123456';
$res = Validator::is_qq($qq);
var_dump($res);

$vStr = '1234562354253434';
$res = Validator::is_idcard($vStr);
var_dump($res);

$url = 'http://www.baidu.com';
$res = Validator::is_url($url);
var_dump($res);

$str = '123456asssss';
$res = Validator::is_alpha_number($str);
var_dump($res);