Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 485 Bytes

README.md

File metadata and controls

26 lines (22 loc) · 485 Bytes

think-validate

安装

composer require reaway/think-validate

用法

use Think\Component\Validate\Facade\Validate;

require __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

$rule = [
    'name'  => 'require|max:25',
    'email' => 'email'
];
$data = [
    'name'  => 'thinkphp',
    'email' => '[email protected]'
];
$validate = Validate::rule($rule);
if (!$validate->check($data)) {
    var_dump($validate->getError());
}