?? ??? ??????:
SymfonyComponentHttpFoundationRequest::__construct()? ??? ???? 1? C:xampphtdocssatusehat2appHttpControllersPasienController.php ?? 68?? ???? ??? ??, ??? ????? ???.
?? ? ????
???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(); }
SymfonyComponentHttpFoundationRequest::create()
來代替,它隱式調(diào)用請求工廠并返回 Request
??? ??? ? ????.
PS: ????? ??? ??? ????. method
參數(shù),因為'GET'
? ??????.