/** * 获取变量,并执行验证参数,验证签名 * @param array $vars 包含参数名称的数组 * @param string $type 获取变量的方式 * @return array $data */ protected function beforeGetVarExecVerify($vars, $type = 'get') { //选择取值方式 $data = []; switch ($type) { case 'get': $data = \Verify::getQuery($vars); break; case 'post': $data = \Verify::getPost($vars); break; case 'request': $data = \Verify::get($vars); break; } //验证参数 if (\Verify::getMessage()) { $this->throwMessage(PARAMETER_FAIL, \Verify::getMessage()); } //赋值 foreach ($vars as $key => $val) { $this->data[$val] = $data[$key]; } //验证签名 $this->beforeVerify(); return $this->data; }