We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CentOS7.3 APACHE2.4 PHP 版本:7.0 overtrue/wechat 版本:4.0-devmaster 是否使用了框架?框架名称:TP5.0
overtrue\wechat\src\Kernel\AccessToken.php ---- line144
public function requestToken(array $credentials): array { $response = $this->sendRequest($credentials); $result = json_decode($response->getBody()->getContents(), true); if (empty($result[$this->tokenKey])) { throw new HttpException('Request access_token fail: '.json_encode($result, JSON_UNESCAPED_UNICODE), $response); } return $result; }
希望这个获取access_toekn失败之后抛出异常的地方,能够与其他地方统一使用下述这个 resolveResponse 返回数据
protected function resolveResponse(ResponseInterface $response, string $type) { $response = Response::buildFromPsrResponse($response); switch ($type) { case 'collection': return $response->toCollection(); case 'array': return $response->toArray(); case 'object': return $response->toObject(); case 'raw': default: $response->getBody()->rewind(); if (class_exists($type)) { return new $type($response); } return $response; } }
The text was updated successfully, but these errors were encountered:
e2de73d
Resolved #951
1b448aa
@Sky9th
try { $token->requestToken($credentials); } catch (\Exception $e) { $e->response; // \Psr\Http\Message\ResponseInterface|null $e->formattedResponse; //根据 response_type 格式化的结果 }
Sorry, something went wrong.
No branches or pull requests
我用的环境
CentOS7.3 APACHE2.4
PHP 版本:7.0
overtrue/wechat 版本:4.0-devmaster
是否使用了框架?框架名称:TP5.0
问题及现象
overtrue\wechat\src\Kernel\AccessToken.php ---- line144
希望这个获取access_toekn失败之后抛出异常的地方,能够与其他地方统一使用下述这个 resolveResponse 返回数据
The text was updated successfully, but these errors were encountered: