# 關于
PHP-Curl是一個輕量級的網絡操作類,實現GET、POST、UPLOAD、DOWNLOAD常用操作,支持方法鏈寫法
# 示例
~~~html
$curl = WechatIndexCommonClass::get('Curl');
~~~
#### GET:
~~~html
$curl->url(目標網址);
~~~
##### POST:
~~~html
$curl->post(變量名, 變量值)->post(多維數組)->url(目標網址);
~~~
##### [](https://github.com/wenpeng/curl/blob/master/README.md#upload)UPLOAD:
~~~html
$curl->post(多維數組)->file($_FILE字段, 本地路徑, 文件類型, 原始名稱)->url(目標網址);
~~~
##### [](https://github.com/wenpeng/curl/blob/master/README.md#download)DOWNLOAD:
~~~html
$curl->url(文件地址)->save(保存路徑);
~~~
##### [](https://github.com/wenpeng/curl/blob/master/README.md#%E9%85%8D%E7%BD%AE)配置
參考:[http://php.net/manual/en/function.curl-setopt.php](http://php.net/manual/en/function.curl-setopt.php)
~~~html
$curl->set('CURLOPT_選項', 值)->post(多維數組)->url(目標網址);
~~~
##### [](https://github.com/wenpeng/curl/blob/master/README.md#%E8%87%AA%E5%8A%A8%E9%87%8D%E8%AF%95)自動重試
~~~html
// 出錯自動重試N次(默認0)
$curl->retry(3)->post(多維數組)->url(目標網址);
~~~
##### [](https://github.com/wenpeng/curl/blob/master/README.md#%E7%BB%93%E6%9E%9C)結果
~~~html
// 任務結果狀態
if ($curl->error()) {
echo $curl->message();
} else {
// 任務進程信息
$info = $curl->info();
// 任務結果內容
$content = $curl->data();
}
~~~