1.发起请求
$client = new Client;
$url = "http://192.168.1.207/icar_dev101/miniapp.php/sstore/hot_goods_list/";
//get通过普通参数获取
$response = $client->get($url,['query' => ['sstore_id' => 1]]);
//post提交普通参数
$response = $client->post($url,['form_params'=>['id'=>2]]);
//post提交文件
$response = $client->post($url,['multipart'=>[
[
'name' => 'qux',//字段键名
'contents' => fopen('/path/to/file', 'r'),//文件句柄
'filename' => 'custom_filename.txt' //文件名
]
]]);
//put提交json
$response = $client->put($url, ['json' => ['foo' => 'bar']]);