- 在请求参数列表中,除去sign,appid,imgupload三个参数外,其他需要使用到的参数皆是要签名的参数
- 对参数里的每一个值从a到z的顺序排序。排序完成之后,再把所有数组值以“&”字符连接起来
- 在MD5 签名时,需要把appkey连接起来再做md5签名.
PHP签名代码算法如下: <?php function verification($arr,$appkey){ //过虑生成新的数组 $para_filter = array(); foreach ($arr as $key => $val ) { if( in_array($key,array('sign','appid','imgupload')) || $val == "")continue; else $para_filter[$key] = $arr[$key]; } //排序数组 ksort($para_filter); reset($para_filter); //再把所有数组值以“&”字符连接起来 $arg = ""; foreach ($para_filter as $key => $val ) { $arg.=$key."=".urlencode($val)."&"; } //去掉最后一个&字符 $arg = substr($arg,0,count($arg)-2); //如果存在转义字符,那么去掉转义 if(get_magic_quotes_gpc()){$arg = stripslashes($arg);} $prestr = $arg . $appkey; return md5($prestr); }
简单说明,哈哈!
within the net attire great retailers sell reasonable flip styles
miranda lambert weight loss Leighton Meester Is a Big Fan of Fashion Eyeglasses with Black Frames
red and white the colors of the Mexican flag
christina aguilera weight lossWho Is Your Fashion Icon
christina aguilera weight lossWho Is Your Fashion Icon