生成规则: 1.sign不参加验签 2.参数为空不参加验签 3.以&拼接
1 /** 2 * 参数排序 3 * 4 * @param array $param 5 * @return string 6 */ 7 public static function _getSortParams($param = []) 8 { 9 unset($param['sign']); 10 ksort($param); 11 $signstr = ''; 12 if (is_array($param)) { 13 foreach ($param as $key => $value) { 14 if ($value == '') { 15 continue; 16 } 17 $signstr .= $key . '=' . $value . '&'; 18 } 19 $signstr = rtrim($signstr, '&'); 20 } 21 return $signstr; 22 }