$val) { if($key == "sign" || $val == "")continue; else $para_filter[$key] = $para[$key]; } return $para_filter; } /** * 对数组排序 * @param $para 排序前的数组 * return 排序后的数组 */ function argSorts($para) { ksort($para); reset($para); return $para; } /** * 签名验证-快接支付 * $datas 数据数组 * $key 密钥 */ function sign($datas = array(), $key = ""){ $str = urldecode(http_build_query($this->argSorts($this->paraFilters($datas)))); // print_r($str);exit; $sign = md5($str."&key=".$key); return $sign; } /** * 签名验证-快接支付 * $datas 数据数组 * $key 密钥 */ function getdata($url, $param){ $content = ''; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_POSTFIELDS, $param); curl_setopt($ch, CURLOPT_TIMEOUT,6); $content = curl_exec($ch); //如果发现异常,排查下curl错误 //echo "curl错误:".curl_error($ch); curl_close($ch); return $content; } }