PFinal\Wechat\SDK\SHA1::getSHA1 PHP Method

getSHA1() public method

用SHA1算法生成安全签名
public getSHA1 ( string $token, string $timestamp, string $nonce, $encrypt_msg )
$token string 票据
$timestamp string 时间戳
$nonce string 随机字符串
    public function getSHA1($token, $timestamp, $nonce, $encrypt_msg)
    {
        //排序
        try {
            $array = array($encrypt_msg, $token, $timestamp, $nonce);
            sort($array, SORT_STRING);
            $str = implode($array);
            return array(ErrorCode::$OK, sha1($str));
        } catch (\Exception $e) {
            //print $e . "\n";
            return array(ErrorCode::$ComputeSignatureError, null);
        }
    }