Created
May 18, 2017 06:43
-
-
Save dolphin836/cd68c923a585150833b1de5355f54c58 to your computer and use it in GitHub Desktop.
[微信签名算法] #tags:微信,算法,签名
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @param array $data 需要签名的数据 | |
* @param string $key 账户的 KEY | |
* | |
* @return string 签名字符串 | |
*/ | |
function sign($data = array(), $key) | |
{ | |
ksort($data); | |
$str = urldecode(http_build_query($data)); | |
$temp = $str . "&key=" . $key; | |
return strtoupper(md5($temp)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment