fix: 修复HTTP一处获取参数bug
This commit is contained in:
@@ -314,7 +314,7 @@ class BaseController
|
|||||||
*/
|
*/
|
||||||
public function export(): Response
|
public function export(): Response
|
||||||
{
|
{
|
||||||
// if (\request()->isAjax()) {
|
if (\request()->isAjax()) {
|
||||||
|
|
||||||
// 获取分页
|
// 获取分页
|
||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
@@ -338,9 +338,9 @@ class BaseController
|
|||||||
|
|
||||||
$downUrl = str_replace(public_path(), '', $filePath);
|
$downUrl = str_replace(public_path(), '', $filePath);
|
||||||
return $this->success('导出成功!', $downUrl);
|
return $this->success('导出成功!', $downUrl);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// return $this->error('非法请求!');
|
return $this->error('非法请求!');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -63,7 +63,13 @@ class Http
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$client = self::getClient($agent, $options, $header);
|
$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);
|
$response = $client->request($method, $url, $query);
|
||||||
$content = $response->getBody()->getContents();
|
$content = $response->getBody()->getContents();
|
||||||
$header = $response->getHeaders();
|
$header = $response->getHeaders();
|
||||||
|
|||||||
Reference in New Issue
Block a user