说明
使用
use Curl\Curl;
$url = '';
$data = [];
$curl = new Curl();
$response = $curl->get($url, $data);
use Curl\Curl;
$url = '';
$data = [];
$curl = new Curl();
$response = $curl->post($url, $data);
use Curl\Curl;
$url = '';
$myfile = curl_file_create('2.png');
$data = ['myfile' => $myfile, 'user' => 'super'];
$curl = new Curl();
$response = $curl->post('http://test.com/index', $data);
if ($curl->error) {
echo 'Error: ' . $curl->errorCode . ': ' . $curl->errorMessage . "\n";
} else {
echo 'Success' . "\n";
}