Building query string programmatically in Guzzle?

后端 未结 3 1749
轻奢々
轻奢々 2021-01-17 14:56

In my PHP Guzzle client code, I have something like

$c = new Client(\'http://test.com/api/1.0/function\');

$request = $c->get(\'?f=4&l=2&p=3&         


        
3条回答
  •  萌比男神i
    2021-01-17 15:27

    Guzzle 6 - you could use query option param

    // Send a GET request to /get?foo=bar
    $client->request('GET', '/get', ['query' => ['foo' => 'bar']]);
    

    http://docs.guzzlephp.org/en/stable/request-options.html#query

提交回复
热议问题