示例1:
$post = [ 'username' => '', 'password' => '', 'passconf' => '', 'email' => '', ]; // 验证表单 $validator = new FormValidator($post); $validator->setRules('username', '用户名', 'required', ['required' => '“用户名”不能为空']); $validator->setRules('password', '密码', 'required'); $validator->setRules('passconf', '确认密码', 'required'); $validator->setRules('email', '邮箱', 'required'); $ret = $validator->run(); if ($ret == false) { echo '表单验证失败:' . $validator->errorFirst(); }