src/Gateways/Alipay/Support.php
public static function getSignContent(array $data, $verify = false): string
    {
        $data = self::encoding($data, $data['charset'] ?? 'gb2312', 'utf-8');

        ksort($data);

        $stringToBeSigned = '';
        foreach ($data as $k => $v) {
            if ($verify && $k != 'sign' && $k != 'sign_type') {
                $stringToBeSigned .= $k.'='.$v.'&';
            }
            if (!$verify && $v !== '' && !is_null($v) && $k != 'sign' && '@' != substr($v, 0, 1)) {
                $stringToBeSigned .= $k.'='.$v.'&';
            }
        }

        Log::debug('Alipay Generate Sign Content Before Trim', [$data, $stringToBeSigned]);

        return trim($stringToBeSigned, '&');
    }
public static function getSignContent(array $data, $verify = false): string
    {
        $data = self::encoding($data, $data['charset'] ?? 'gb2312', 'utf-8');

        ksort($data);

        $stringToBeSigned = '';
        foreach ($data as $k => $v) {
            if ($verify && $k != 'sign' && $k != 'sign_type') {
                $stringToBeSigned .= $k.'='.$v.'&';
            }
            if (!$verify && $v !== '' && !is_null($v) && $k != 'sign' && '@' != substr($v, 0, 1)) {
                $stringToBeSigned .= $k.'='.$v.'&';
            }
        }

        Log::debug('Alipay Generate Sign Content Before Trim', [$data, $stringToBeSigned]);

        return trim($stringToBeSigned, '&');
    }
public static function getSignContent ( array $ data , $ verify = false ) : string { $ data = self :: encoding ( $ data , $ data [ 'charset' ] ?? 'gb2312' , 'utf-8' ) ; ksort ( $ data ) ; $ stringToBeSigned = '' ; foreach ( $ data as $ k => $ v ) { if ( $ verify && $ k != 'sign' && $ k != 'sign_type' ) { $ stringToBeSigned .= $ k . '=' . $ v . '&' ; } if ( ! $ verify && $ v !== '' && ! is_null ( $ v ) && $ k != 'sign' && '@' != substr ( $ v , 0 , 1 ) ) { $ stringToBeSigned .= $ k . '=' . $ v . '&' ; } } Log :: debug ( 'Alipay Generate Sign Content Before Trim' , [ $ data , $ stringToBeSigned ] ) ; return trim ( $ stringToBeSigned , '&' ) ; }
Get signContent that is to be signed.

@author yansongda <me@yansongda.cn>

@param array $data
@param bool  $verify

@return string
Get signContent that is to be signed .