## 發送POST請求
~~~
use \api\Http;
// 發送一個POST請求到http://127.0.0.1并且POST一些數據
// @param : API地址
// @param : POST的數據,可以是字符串或者是數組
// @param : 附加參數
$data = Http::post('http://127.0.0.1', [
'id' => 1,
'name' => 'test'
]);
// 自定義請求超時時間為10秒
$data = Http::post('http://127.0.0.1', [
'id' => 1,
'name' => 'test'
], [
'timeout' => 10
]);
// 在HEADER頭中增加一個參數,name等于test
$data = Http::post('http://127.0.0.1', [
'id' => 1,
'name' => 'test'
], [
'header' => [
'name' => 'test'
]
]);
// 完整參數示例
$data = Http::post('http://127.0.0.1', [
'id' => 1,
'name' => 'test'
], [
// 請求參數列表
'query' => [
'id' => 1
],
// 設置HEADER
'header' => [
'name' => 'test'
],
// 超時時間
'timeout' => 10
]);
~~~