form_params

摘要

用来发送一个 application/x-www-form-urlencoded POST请求.

类型

array

常量

GuzzleHttp\RequestOptions::FORM_PARAMS

关联数组由表单字段键值对构成,每个字段值可以是一个字符串或一个包含字符串元素的数组。 当没有准备 “Content-Type” 报文头的时候,将设置为 “application/x-www-form-urlencoded”。

  1. $client->request('POST', '/post', [
  2. 'form_params' => [
  3. 'foo' => 'bar',
  4. 'baz' => ['hi', 'there!']
  5. ]
  6. ]);