- wechatpay-guzzle-middleware如何上传图片?
如何使用这个sdk上传图片。我是用如下代码,无法通过验签 $wechatPayMiddleware = WechatPayMiddleware::builder() ->withMerchant(CommonData::MCH_ID, CommonData::SERIAL_NUMBER, CommonData::getPrivateKey()) ->withWechatPay([ CommonData::getCertificate() ]) // 可传入多个微信支付平台证书,参数类型为array ->withValidator(new NoValidator()) ->build(); // 将WechatPayMiddleware添加到Guzzle的HandlerStack中 $stack = HandlerStack::create(); $stack->push($wechatPayMiddleware, 'wechatpay'); // 创建Guzzle HTTP Client时,将HandlerStack传入 $client = new \GuzzleHttp\Client(['handler' => $stack, 'verify' => false]); $url = 'https://xxx.com/'.$object; // 接下来,正常使用Guzzle发起API请求,WechatPayMiddleware会自动地处理签名和验签 $resp = $client->request('POST', CommonData::URL . $this->getUri(), [ 'headers' => [ 'Accept' => 'application/json' ], 'multipart' => [ [ 'name'=>'file', 'contents'=>fopen($url, 'r') ], [ 'name'=>'meta', 'contents'=>json_encode([ 'filename'=>basename($url), 'sha256'=>hash('sha256', (new Oss())->downloadFile('hic-image', $object)), ]) ] ], ]); $result = json_decode($resp->getBody()->getContents(), true);
2019-12-21 - 请问微信支付API v3中,获取平台证书列表的参数怎么获取?
[图片] 如图,请问认证信息和用户代理这两个参数要怎么获取? string(66) "{"code":"SYSTEM_ERROR","message":"系统繁忙,请稍后重试"}" 这是什么错误,没有明显提示 publicfunctionget_serial_no(){ $url = 'https://api.mch.weixin.qq.com/v3/certificates' $sign = $this->sign($url,'POST') $header[] = "User-Agent:"$_SERVER'HTTP_USER_AGENT' $header[] = 'Accept:application/json' $header[] = 'Authorization:WECHATPAY2-SHA256-RSA2048 '$sign $r = $this->doCurl$url''$header var_dump($r
2020-01-08