Rumah  >  Artikel  >  pembangunan bahagian belakang  >  php:网上支付

php:网上支付

WBOY
WBOYasal
2016-07-30 13:31:031529semak imbas
html> head> meta http-equiv="content_type" c/span>"text/html;charset=gb2312" /> head> form action="payconfirm.php" method="post"> table> tr> td colspan="4"> 订单号:input type="text" name="p2_Order"/> 支付金额:input type="text" name="p3_Amt"/> td> tr> tr>td colspan="4">请选择银行:td>tr> tr> td>input type="radio" name="pd_FrpId" value="CCB-NET"/>建设银行td> td>input type="radio" name="pd_FrpId" value="ABC-NET"/>农业银行td> td>input type="radio" name="pd_FrpId" value="CMBCHINA-NET"/>招商银行td> td>input type="radio" name="pd_FrpId" value="ICBC-NET"/>工商银行td> tr> tr>td colspan="4">input type="submit" value="支付">td>tr> table> form> html>html> head> meta http-equiv="content-type" c/span>"text/html;charset=gb2312" /> head> include_once 'common.php'; //获取支付请求信息 $p0_Cmd="Buy"; $p1_MerId="10012006921";//商户编号(测试帐号) $p2_Order=$_POST['p2_Order']; $p3_Amt=$_POST['p3_Amt'];//支付金额,请务必注意金额; $p4_Cur="CNY"; $p5_Pid=""; $p6_Pcat=""; $p7_Pdesc=""; $p8_Url="http://localhost:80/Hanshunping/PAY/res.php"; $p9_SAF="0"; $pa_MP=""; $pd_FrpId=$_POST['pd_FrpId']; $pr_NeedResponse="1"; /* hmac是一种对称密钥验证算法。 通过请求参数拼接的字符串和贵公司在易宝支付的密钥生成。作用是防止恶意篡改请求数据。*/ $data=""; $data=$data.$p0_Cmd; $data=$data.$p1_MerId; $data=$data.$p2_Order; $data=$data.$p3_Amt; $data=$data.$p4_Cur; $data=$data.$p5_Pid; $data=$data.$p6_Pcat; $data=$data.$p7_Pdesc; $data=$data.$p8_Url; $data=$data.$p9_SAF; $data=$data.$pa_MP; $data=$data.$pd_FrpId; $data=$data.$pr_NeedResponse; $Merchantkey="qV490l4XHJ6Dc32Zu7x90V43gVP4C5061938W01t47S1AY734Dcr27011546"; $hmac=HmacMd5($data,$Merchantkey); ?> 您的订单号为: $p2_Order; ?> 支付金额为:$p3_Amt;?> form action="https://www.yeepay.com/app-merchant-proxy/node" method="post"> input type="hidden" name="p0_Cmd" value="$p0_Cmd;?>"/> input type="hidden" name="p1_MerId" value="$p1_MerId;?>"/> input type="hidden" name="p2_Order" value="$p2_Order;?>"/> input type="hidden" name="p3_Amt" value="$p3_Amt;?>"/> input type="hidden" name="p4_Cur" value="$p4_Cur;?>"/> input type="hidden" name="p5_Pid" value="$p5_Pid;?>"/> input type="hidden" name="p6_Pcat" value="$p6_Pcat;?>"/> input type="hidden" name="p7_Pdesc" value="$p7_Pdesc;?>"/> input type="hidden" name="p8_Url" value="$p8_Url;?>"/> input type="hidden" name="p9_SAF" value="$p9_SAF;?>"/> input type="hidden" name="pa_MP" value="$pa_MP;?>"/> input type="hidden" name="pd_FrpId" value="$pd_FrpId;?>"/> input type="hidden" name="pr_NeedResponse" value="$pr_NeedResponse;?>"/> input type="hidden" name="hmac" value="$hmac;?>"/> input type="submit" value="确认支付"/> form> html>
function HmacMd5($data,$key) { // RFC 2104 HMAC implementation for php. // Creates an md5 HMAC. // Eliminates the need to install mhash to compute a HMAC // Hacked by Lance Rushing(NOTE: Hacked means written) //需要配置环境支持iconv,否则中文参数不能正常处理 $key = iconv("GB2312","UTF-8",$key); $data = iconv("GB2312","UTF-8",$data); $b = 64; // byte length for md5 if (strlen($key) > $b) { $key = pack("H*",md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad ; $k_opad = $key ^ $opad; return md5($k_opad . pack("H*",md5($k_ipad . $data))); } ?>--------------------------------------------------------echo "支付成功!"; ?>

以上就介绍了php:网上支付,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn