国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

參數(shù) 1 傳遞給 Symfony\Component\HttpFoundation\Request::__construct()
P粉378890106
P粉378890106 2024-02-26 11:29:01
0
1
457

我有這樣的錯誤:

傳遞給 Symfony\Component\HttpFoundation\Request::__construct() 的參數(shù) 1 必須是給定的數(shù)組、字符串類型,在 C:\xampp\htdocs\satusehat2\app\Http\Controllers\PasienController 中調(diào)用.php 第 68 行。

這是我的功能

public function curl_postman() {
        $client = new Client();
        $headers = [
          'Content-Type' => 'application/json',
          'Authorization' => 'My Bearer token'
        ];
        $body = '';
        $request = new Request('GET', 'my-api-address', $headers, $body);
        $res = $client->sendAsync($request)->wait();
        echo $res->getBody();
        
    }

第 68 行是

$body = '';

P粉378890106
P粉378890106

全部回復(1)
P粉124070451

您可以使用 Symfony\Component\HttpFoundation\Request::create() 來代替,它隱式調(diào)用請求工廠并返回 Request 對象。

$request = Request::create(uri: 'my-api-address', content: $body, server: $headers)

PS:不需要顯式指定method參數(shù),因為'GET'是默認值。

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板