public function Home_index(){
$ref= md5("appid=wx4654546&mch_id=1278391239&nonce_str=2194kfhaafaf384&op_user_id=646131"
. "&out_refund_no=D2131231&out_trade_no=1231jaf&refund_fee=0.01&total_fee=0.01"
. "&transaction_id=1293102u4slfk14&key=asduaisd12739182");//sign加密MD5
$refund=array(
'appid'=>'1',
'mch_id'=>'1',//商户号
'nonce_str'=>'1',//随机字符串
'op_user_id'=>'1',
'out_refund_no'=>'1',
'out_trade_no'=>'1',
'refund_fee'=>'1',
'total_fee'=>'1',
'transaction_id'=>'1',
'sign'=>$ref
);
$url=" https://api.mch.weixin.qq.com/secapi/pay/refund" ;;//微信退款地址,post请求
$xml=arrayToXml($refund);
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HEADER,1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,1);//证书检查
curl_setopt($ch,CURLOPT_SSLCERTTYPE,'pem');
curl_setopt($ch,CURLOPT_SSLCERT,dirname(__FILE__).'/WxPayPubHelper/cacert/apiclient_cert.pem');
curl_setopt($ch,CURLOPT_SSLCERTTYPE,'pem');
curl_setopt($ch,CURLOPT_SSLKEY,dirname(__FILE__).'/WxPayPubHelper/cacert/apiclient_key.pem');
curl_setopt($ch,CURLOPT_SSLCERTTYPE,'pem');
curl_setopt($ch,CURLOPT_CAINFO,dirname(__FILE__).'/WxPayPubHelper/cacert/rootca.pem');
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$xml);
$data=curl_exec($ch);
if($data){ //返回来的是xml格式需要转换成数组再提取值,用来做更新
curl_close($ch);
dump($data);
}else{
$error=curl_errno($ch);
echo "curl出错,错误代码:$error"."<br/>";
echo "<a href=' http://curl.haxx.se/libcurl/c/libcurs.html'> ;错误原因查询</a><br/>";
curl_close($ch);
echo false;
}
}
$ref= md5("appid=wx4654546&mch_id=1278391239&nonce_str=2194kfhaafaf384&op_user_id=646131"
. "&out_refund_no=D2131231&out_trade_no=1231jaf&refund_fee=0.01&total_fee=0.01"
. "&transaction_id=1293102u4slfk14&key=asduaisd12739182");//sign加密MD5
$refund=array(
'appid'=>'1',
'mch_id'=>'1',//商户号
'nonce_str'=>'1',//随机字符串
'op_user_id'=>'1',
'out_refund_no'=>'1',
'out_trade_no'=>'1',
'refund_fee'=>'1',
'total_fee'=>'1',
'transaction_id'=>'1',
'sign'=>$ref
);
$url=" https://api.mch.weixin.qq.com/secapi/pay/refund" ;;//微信退款地址,post请求
$xml=arrayToXml($refund);
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HEADER,1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,1);//证书检查
curl_setopt($ch,CURLOPT_SSLCERTTYPE,'pem');
curl_setopt($ch,CURLOPT_SSLCERT,dirname(__FILE__).'/WxPayPubHelper/cacert/apiclient_cert.pem');
curl_setopt($ch,CURLOPT_SSLCERTTYPE,'pem');
curl_setopt($ch,CURLOPT_SSLKEY,dirname(__FILE__).'/WxPayPubHelper/cacert/apiclient_key.pem');
curl_setopt($ch,CURLOPT_SSLCERTTYPE,'pem');
curl_setopt($ch,CURLOPT_CAINFO,dirname(__FILE__).'/WxPayPubHelper/cacert/rootca.pem');
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$xml);
$data=curl_exec($ch);
if($data){ //返回来的是xml格式需要转换成数组再提取值,用来做更新
curl_close($ch);
dump($data);
}else{
$error=curl_errno($ch);
echo "curl出错,错误代码:$error"."<br/>";
echo "<a href=' http://curl.haxx.se/libcurl/c/libcurs.html'> ;错误原因查询</a><br/>";
curl_close($ch);
echo false;
}
}