/** * 验证验证码 * * @param string $field 表单字段 * * @return bool */ public function auth($field = 'code') { return !isset($_POST[$field]) || strtoupper($_POST[$field]) == Code::get(); }
public function captcha($field, $value, $params, $data) { $post = Request::post(); return isset($post[$field]) && strtoupper($post[$field]) == \Code::get(); }