PHP code example of seffeng / rules
1. Go to this page and download the library: Download seffeng/rules 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/ */
seffeng / rules example snippets
use Seffeng\Rules\IDNumber;
/**
* Test.php
* 方法验证示例
*/
public function test()
{
$rule = new IDNumber();
// 严格模式,验证所属地
$rule->setIsStrict(true);
// 是否返回所属地
$rule->setIsLocation(false);
$value = '123456789123456789';
var_dump($rule->passes($value));exit;
}
├─src
│ IDNumber.php 身份证号
│ Password.php 密码
│ Phone.php 手机号