fix: 修复HTTP一处获取参数bug

This commit is contained in:
Ying
2023-07-11 10:50:22 +08:00
parent 550403b9ab
commit c0bc6c25e7
2 changed files with 10 additions and 4 deletions

View File

@@ -63,7 +63,13 @@ class Http
{
try {
$client = self::getClient($agent, $options, $header);
$query = $method == 'GET' ? ['query' => $params] : ['form_params' => $params];
$query = [];
if ($method == 'GET') {
$query_string = http_build_query($params);
$url = $query_string ? $url . (stripos($url, "?") !== false ? "&" : "?") . $query_string : $url;
} else {
$query['form_params'] = $params;
}
$response = $client->request($method, $url, $query);
$content = $response->getBody()->getContents();
$header = $response->getHeaders();