public function getSandboxSignKey()
    {
        $this->setSign();

        $xml = DataParser::toXml($this->getData());

        $url = self::SANDBOX_URL;

        $client = new Client([
            'timeout' => '10.0'
        ]);
        $options = [
            'body' => $xml,
            'http_errors' => false
        ];

        $response = $client->request('POST', self::SANDBOX_URL, $options);

        if ($response->getStatusCode() != '200') {
            throw new PayException('网络发生错误，请稍后再试curl返回码：' . $response->getReasonPhrase());
        }
        // 格式化为数组
        $retData = DataParser::toArray($response->getBody()->getContents());
        if (strtoupper($retData['return_code']) != 'SUCCESS') {
            throw new PayException('微信返回错误提示:' . $retData['retmsg']);
        }

        return $retData['sandbox_signkey'];
    }
public function getSandboxSignKey()
    {
        $this->setSign();

        $xml = DataParser::toXml($this->getData());

        $url = self::SANDBOX_URL;

        $client = new Client([
            'timeout' => '10.0'
        ]);
        $options = [
            'body' => $xml,
            'http_errors' => false
        ];

        $response = $client->request('POST', self::SANDBOX_URL, $options);

        if ($response->getStatusCode() != '200') {
            throw new PayException('网络发生错误，请稍后再试curl返回码：' . $response->getReasonPhrase());
        }
        
        $retData = DataParser::toArray($response->getBody()->getContents());
        if (strtoupper($retData['return_code']) != 'SUCCESS') {
            throw new PayException('微信返回错误提示:' . $retData['retmsg']);
        }

        return $retData['sandbox_signkey'];
    }
public function getSandboxSignKey ( ) { $ this -> setSign ( ) ; $ xml = DataParser :: toXml ( $ this -> getData ( ) ) ; $ url = self :: SANDBOX_URL ; $ client = new Client ( [ 'timeout' => '10.0' ] ) ; $ options = [ 'body' => $ xml , 'http_errors' => false ] ; $ response = $ client -> request ( 'POST' , self :: SANDBOX_URL , $ options ) ; if ( $ response -> getStatusCode ( ) != '200' ) { throw new PayException ( '网络发生错误，请稍后再试curl返回码：' . $response->getReasonPhrase()) } // 格式化为数组 $ retData = DataParser :: toArray ( $ response -> getBody ( ) -> getContents ( ) ) ; if ( strtoupper ( $ retData [ 'return_code' ] ) != 'SUCCESS' ) { throw new PayException ( '微信返回错误提示:' . $retData['ret s ' ]); } return $ retData [ 'sandbox_signkey' ] ; }
获取沙盒的签名信息
@return mixed
@throws PayException
获取沙盒的签名信息