PHP支付接口签名生成数据

2021/8/1 17:37:15

本文主要是介绍PHP支付接口签名生成数据,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

<?php

//作者主页 https://www.woailunwen.com

$pay_memberid = '商户号';

$pay_orderid = '订单号';

$pay_amount = '支付金额';

$pay_applydate = date("Y-m-d H:i:s");  //订单时间

$pay_bankcode = '通道编码';

$pay_notifyurl = '异步地址';

$pay_callbackurl = '同步地址';

$Md5key = '你的密钥';

$native = array(

    "pay_memberid" => $pay_memberid,

    "pay_orderid" => $pay_orderid,

    "pay_amount" => $pay_amount,

    "pay_applydate" => $pay_applydate,

    "pay_bankcode" => $pay_bankcode,

    "pay_notifyurl" => $pay_notifyurl,

    "pay_callbackurl" => $pay_callbackurl,

);

ksort($native);

$md5str = "";

foreach ($native as $key => $val) {

    $md5str = $md5str . $key . "=" . $val . "&";

}

//作者主页 https://www.bz80.com

echo '签名串:';echo($md5str . "key=" . $Md5key);

$sign = strtoupper(md5($md5str . "key=" . $Md5key));

$native["pay_md5sign"] = $sign;

echo '<br>得到签名后,转换为大写字母。<br>';

echo $sign;

?>



这篇关于PHP支付接口签名生成数据的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程