国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

Http客戶端發(fā)送 Multipart 表單請(qǐng)求 post請(qǐng)求問(wèn)題

晚安。

截圖

http://www.wtbis.cn/plugin/94
截圖
現(xiàn)在這樣報(bào)錯(cuò)

GuzzleHttp\Exception\InvalidArgumentException: You cannot use form_params and multipart at the same time. Use the form_params option if you want to send application/x-www-form-urlencoded requests, and the multipart option to send multipart/form-data requests
1462 1 0
1個(gè)回答

sbf
//https://github.com/yzh52521/easyhttp/blob/master/src/Request.php
/**
* Request constructor.
*/
public function __construct()
{
$this->client = $this->getInstance();

$this->bodyFormat = 'form_params'; // 注意這里的初始化
$this->options    = [
'http_errors' => false,
];
if (!$this->handlerStack instanceof HandlerStack) {
$this->handlerStack = HandlerStack::create( new CurlHandler() );
}
$this->options['handler'] = $this->handlerStack;
}

public function post(string $url,array $data = [])
{
    $this->options[$this->bodyFormat] = $data; // 這里

    return $this->request( 'POST',$url,$data );
}

看看源碼,多傳了個(gè)參數(shù) form_params

  • 晚安。 2022-12-13

    $response = Http::attach('filename', file_get_contents('1.txt'), '1.txt', [
    'enctype' => 'multipart/form-data'
    ])
    ->withBasicAuth($a, $b)
    ->post('https://api.aa.cn/v3');

        print_r($response->array());
年代過(guò)于久遠(yuǎn),無(wú)法發(fā)表回答
??