本文整理汇总了PHP中tool::check_serialization方法的典型用法代码示例。如果您正苦于以下问题:PHP tool::check_serialization方法的具体用法?PHP tool::check_serialization怎么用?PHP tool::check_serialization使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tool
的用法示例。
在下文中一共展示了tool::check_serialization方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
public function handle()
{
//echo kohana::debug($this->fileds);
//数据验证
$validator = new Validation($this->fileds);
$validator->pre_filter('trim');
$validator->add_rules('submit_url', 'required');
$validator->add_rules('order_num', 'required');
$validator->add_rules('order_amount', 'required');
$validator->add_rules('order_currency', 'required');
$validator->add_rules('card_num', 'required');
$validator->add_rules('card_type', 'required');
$validator->add_rules('card_cvv', 'required');
$validator->add_rules('card_exp_month', 'required');
$validator->add_rules('card_exp_year', 'required');
$validator->add_rules('card_valid_month', 'standard_text');
$validator->add_rules('card_valid_year', 'standard_text');
$validator->add_rules('card_issue', 'standard_text');
if (!$validator->validate()) {
//错误输出,js层已经过滤,一般不会输出
$validate_errors = $validator->errors();
$errors = '';
foreach ($validate_errors as $key => $val) {
$errors .= $key . ' failed rule ' . $val . '<br>';
}
throw new PaymentException($errors, 400);
}
$post_url = $this->fileds['submit_url'];
$post_var = "order_num=" . $this->fileds['order_num'] . "&order_amount=" . $this->fileds['order_amount'] . "&order_currency=" . $this->fileds['order_currency'] . "&card_num=" . $this->fileds['card_num'] . "&card_type=" . $this->fileds['card_type'] . "&card_cvv=" . $this->fileds['card_cvv'] . "&card_exp_month=" . $this->fileds['card_exp_month'] . "&card_exp_year=" . $this->fileds['card_exp_year'] . "&card_issue=" . $this->fileds['card_issue'] . "&card_valid_month=" . $this->fileds['card_valid_month'] . "&card_valid_year=" . $this->fileds['card_valid_year'] . "&billing_firstname=" . $this->fileds['billing_firstname'] . "&billing_lastname=" . $this->fileds['billing_lastname'] . "&billing_address=" . $this->fileds['billing_address'] . "&billing_zip=" . $this->fileds['billing_zip'] . "&billing_city=" . $this->fileds['billing_city'] . "&billing_state=" . $this->fileds['billing_state'] . "&billing_country=" . $this->fileds['billing_country'] . "&billing_telephone=" . $this->fileds['billing_telephone'] . "&billing_ip_address=" . $this->fileds['billing_ip_address'] . "&billing_email=" . $this->fileds['billing_email'] . "&shipping_firstname=" . $this->fileds['shipping_firstname'] . "&shipping_lastname=" . $this->fileds['shipping_lastname'] . "&shipping_address=" . $this->fileds['shipping_address'] . "&shipping_zip=" . $this->fileds['shipping_zip'] . "&shipping_city=" . $this->fileds['shipping_city'] . "&shipping_state=" . $this->fileds['shipping_state'] . "&shipping_country=" . $this->fileds['shipping_country'] . "&secure_code=" . $this->fileds['secure_code'] . "&site_id=" . $this->fileds['site_id'];
$result = tool::curl_pay($post_url, $post_var);
$error_msg = '';
$is_serialization = tool::check_serialization($result, $error_msg);
$res = null;
if ($is_serialization) {
$result = stripcslashes($result);
$res = unserialize($result);
}
$return_key = array('status_id', 'trans_id', 'message', 'api', 'avs', 'status', 'flag');
$return_arr = arr::init_arr($return_key, $res);
return $return_arr;
}