使用easywechat6.x版本示例,报错:Malformed UTF-8 characters, possibly incorrectly encoded,代码如下
public function getWxQrcodePath(): Response
{
try {
$api = $this->app->getClient();
$response = $api->postJson('wxa/getwxacodeunlimit', [
'scene' => 123,
'page' => 'pages/index/index',
'width' => 430,
]);
$path = $response->saveAs('path/to/file.jpg');
return $this->success('获取成功',$path);
}catch(\Throwable $e){
return $this->error($e->getMessage());
}
}
// 尝试内容转换成流返回保存时,错误信息为Call to a member function saveAs() on resource
public function getWxQrcodePath(): Response
{
try {
$api = $this->app->getClient();
$response = $api->postJson('wxa/getwxacodeunlimit', [
'scene' => 123,
'page' => 'pages/index/index',
'width' => 430,
])->toStream();
$path = $response->saveAs('path/to/file.jpg');
return $this->success('获取成功',$path);
}catch(\Throwable $e){
return $this->error($e->getMessage());
}
}
问题如何解决