如何使用Wixel / GUMP验证类比较两个字段

时间:2017-12-21 14:29:45

标签: php validation

我知道如何比较密码和确认密码字段以进行验证,但最近我更新到了GUMP php validation库。如果您已经使用过它,那么您就知道使用它的难易程度,而且它比提供自己的验证代码要好得多。

那就是说,我没看到你如何比较密码和确认密码字段。如果你能帮我比较这两个(密码和确认密码),我将不胜感激。

如果你想看看我在做什么

$customer_name = $_POST['your_name'];
$customer_email = $_POST['your_email'];
$customer_mobile_number = $_POST['mobile_number'];
$customer_password = $_POST['password'];
$password_confirmation = $_POST['password_confirmation'];

$_POST = array( 'name' => $customer_name,
                       'email' => $customer_email,
                       'mobilenumber' => $customer_mobile_number,
                       'password' => $customer_password,
                       'confirmpassword' => $password_confirmation
);

$rules = array('name' => 'required|alpha_space|max_len,120|min_len,3',
                    'email' => 'required|valid_email|max_len,120|min_len,7',
                    'mobilenumber' => 'required|phone_number|exact_len,10',
                    'password' => 'required|max_len,15|min_len,6'
);

$filters = array('name' => 'trim|sanitize_string',
                    'email' => 'trim|sanitize_email',
                    'mobilenumber' => 'trim|sanitize_numbers',
                    'password' => 'trim|sha1'
);

0 个答案:

没有答案