php put 参数,php – 如何在Guzzle 5中发送PUT请求的参数?
生活随笔
收集整理的這篇文章主要介紹了
php put 参数,php – 如何在Guzzle 5中发送PUT请求的参数?
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
根據
the manual,
The body option is used to control the body of an entity enclosing
request (e.g., PUT, POST, PATCH).
記錄的put’ing方法是:
$client = new GuzzleHttp\Client();
$client->put('http://httpbin.org', [
'headers' => ['X-Foo' => 'Bar'],
'body' => [
'field' => 'abc',
'other_field' => '123'
],
'allow_redirects' => false,
'timeout' => 5
]);
編輯
根據您的評論:
您缺少createRequest函數的第三個參數 – 構成post或put數據的鍵/值對數組:
$request = $client->createRequest('PUT', '/put', ['body' => ['foo' => 'bar']]);
總結
以上是生活随笔為你收集整理的php put 参数,php – 如何在Guzzle 5中发送PUT请求的参数?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 白金回收多少钱啊?
- 下一篇: 宜春做输卵管手术最好的医院推荐