Guzzle客户端请求方法返回响应对象而不是请求对象

I am new to Guzzle and tried to read documentation, but still can't find the answer for it.

For example - I get this code from here

$request = $client->post('http://httpbin.org/post', array(), array(
    'custom_field' => 'my custom value',
    'file_field'   => '@/path/to/file.xml'
));

$response = $request->send();

I tried to do the same thing, but when $client->post() is executed, it returns a response object, instead of request. What can be wrong?

I am using the version 6.

As per Guzzle Docs all of the "magic methods", get(), delete(), put(), post(), options(), patch() and head() will return a response object.

If you check the GuzzleHttp\Client source code, you will see that the magic methods are actually abstractions to Client::request() handled by Client::__call().

Regardless of the request type, you should always receive a response.