其实那边支付方的客服已经说的很详细了,估计是这位坛友比小编还菜引起的缘故吧。那小编写个代码就能获得支付签名了哦。代码如下:
- <?php
- function generateSign($params, $key) {
- ksort($params);
- $stringA = '';
- foreach ($params as $k => $v) {
- if ($v !== '' && $k !== 'sign' && $k !== 'key') {
- $stringA .= "$k=$v&";
- }
- }
- $stringA .= "key=$key";
- $signValue = strtoupper(md5($stringA));
- return $signValue;
- }
- $params = [
- 'merchantid' => 'your_merchant_id',
- 'orderNo' => 'your_order_number',
- 'code' => 'your_payment_code',
- 'amount' => 'your_amount',
- 'notifyUrl' => 'your_notify_url',
- 'returnUrl' => 'your_return_url',
- 'key' => 'your_key'
- ];
- $params['sign'] = generateSign($params, $params['key']);
- print_r($params['sign']);