Skip to content

Instantly share code, notes, and snippets.

@xhat
Last active June 7, 2017 23:04
Show Gist options
  • Save xhat/371b8caac1d9d5b280cb545e83c7d79b to your computer and use it in GitHub Desktop.
Save xhat/371b8caac1d9d5b280cb545e83c7d79b to your computer and use it in GitHub Desktop.
payjs.cn签名方法
<?php
/**
* 签名方法:
* 1.把所有参数根据参数名首字母asc码排序
* 2.以键值 http querystring 方式连接
* 3.取md5值转化为大写
*/
function sign(array $data)
{
$key = '21341234124312344';
ksort($data);
$sign = strtoupper(md5(urldecode(http_build_query($data)).'&key='.$key));
return $sign;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment