mirror of
https://gitee.com/zoujingli/WeChatDeveloper.git
synced 2025-04-06 03:58:03 +08:00
Update WeChat/Script.php
This commit is contained in:
parent
a2d43b86b0
commit
42a07c153b
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
namespace WeChat;
|
namespace WeChat;
|
||||||
|
|
||||||
use WeChat\Contracts\Tools;
|
|
||||||
use WeChat\Contracts\BasicWeChat;
|
use WeChat\Contracts\BasicWeChat;
|
||||||
|
use WeChat\Contracts\Tools;
|
||||||
use WeChat\Exceptions\InvalidResponseException;
|
use WeChat\Exceptions\InvalidResponseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,18 +104,14 @@ class Script extends BasicWeChat
|
|||||||
* 数据生成签名
|
* 数据生成签名
|
||||||
* @param array $data 签名数组
|
* @param array $data 签名数组
|
||||||
* @param string $method 签名方法
|
* @param string $method 签名方法
|
||||||
|
* @param array $params 签名参数
|
||||||
* @return bool|string 签名值
|
* @return bool|string 签名值
|
||||||
*/
|
*/
|
||||||
protected function getSignature($data, $method = "sha1")
|
protected function getSignature($data, $method = "sha1", $params = [])
|
||||||
{
|
{
|
||||||
if (!function_exists($method)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ksort($data);
|
ksort($data);
|
||||||
$params = [];
|
if (!function_exists($method)) return false;
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $k => $v) array_push($params, "{$k}={$v}");
|
||||||
$params[] = "{$key}={$value}";
|
|
||||||
}
|
|
||||||
return $method(join('&', $params));
|
return $method(join('&', $params));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user