图片下载
下载图片API为通用接口,消费者投诉相关图片都可以通过该接口进行下载。
请求参数 | 类型 | 描述 |
---|---|---|
media_id | string | 媒体文件ID |
php
$mediaUrl = 'https://api.mch.weixin.qq.com/v3/merchant-service/images/xxxxx';
$uri = new \GuzzleHttp\Psr7\Uri($mediaUrl);
$segment = \substr($uri->getPath(), 28);
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./image.jpg', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$instance->v3->merchantService->images->_media_id_->getAsync([
'sink' => $stream,
'media_id' => \rawurldecode($segment),
])
->wait();
php
$mediaUrl = 'https://api.mch.weixin.qq.com/v3/merchant-service/images/xxxxx';
$uri = new \GuzzleHttp\Psr7\Uri($mediaUrl);
$segment = \substr($uri->getPath(), 28);
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./image.jpg', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$instance->chain('v3/merchant-service/images/{media_id}')->getAsync([
'sink' => $stream,
'media_id' => \rawurldecode($segment),
])
->wait();
php
$mediaUrl = 'https://api.mch.weixin.qq.com/v3/merchant-service/images/xxxxx';
$uri = new \GuzzleHttp\Psr7\Uri($mediaUrl);
$segment = \substr($uri->getPath(), 28);
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./image.jpg', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$instance['v3/merchant-service/images/{media_id}']->getAsync([
'sink' => $stream,
'media_id' => \rawurldecode($segment),
])
->wait();
php
$mediaUrl = 'https://api.mch.weixin.qq.com/v3/merchant-service/images/xxxxx';
$uri = new \GuzzleHttp\Psr7\Uri($mediaUrl);
$segment = \substr($uri->getPath(), 28);
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./image.jpg', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$instance->v3->merchantService->images->_media_id_->get([
'sink' => $stream,
'media_id' => \rawurldecode($segment),
]);
php
$mediaUrl = 'https://api.mch.weixin.qq.com/v3/merchant-service/images/xxxxx';
$uri = new \GuzzleHttp\Psr7\Uri($mediaUrl);
$segment = \substr($uri->getPath(), 28);
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./image.jpg', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$instance->chain('v3/merchant-service/images/{media_id}')->get([
'sink' => $stream,
'media_id' => \rawurldecode($segment),
]);
php
$mediaUrl = 'https://api.mch.weixin.qq.com/v3/merchant-service/images/xxxxx';
$uri = new \GuzzleHttp\Psr7\Uri($mediaUrl);
$segment = \substr($uri->getPath(), 28);
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./image.jpg', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$instance['v3/merchant-service/images/{media_id}']->get([
'sink' => $stream,
'media_id' => \rawurldecode($segment),
]);
返回字典 | 类型 | 描述 |
---|---|---|
文件流(保存后按本地图片查看) |