改名
This commit is contained in:
@@ -19,6 +19,7 @@ abstract class ClientAbstracts extends Component implements IClient
|
|||||||
{
|
{
|
||||||
|
|
||||||
const POST = 'post';
|
const POST = 'post';
|
||||||
|
const UPLOAD = 'upload';
|
||||||
const GET = 'get';
|
const GET = 'get';
|
||||||
const DELETE = 'delete';
|
const DELETE = 'delete';
|
||||||
const OPTIONS = 'options';
|
const OPTIONS = 'options';
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ class Curl extends ClientAbstracts
|
|||||||
$resource = $this->do(curl_init($host . $path), $host . $path, $method);
|
$resource = $this->do(curl_init($host . $path), $host . $path, $method);
|
||||||
if ($method === self::POST && !empty($params)) {
|
if ($method === self::POST && !empty($params)) {
|
||||||
curl_setopt($resource, CURLOPT_POSTFIELDS, HttpParse::parse($params));
|
curl_setopt($resource, CURLOPT_POSTFIELDS, HttpParse::parse($params));
|
||||||
|
} else if ($method === self::UPLOAD) {
|
||||||
|
curl_setopt($resource, CURLOPT_POSTFIELDS, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isHttps !== false) {
|
if ($isHttps !== false) {
|
||||||
@@ -124,8 +126,7 @@ class Curl extends ClientAbstracts
|
|||||||
curl_setopt($resource, CURLOPT_RETURNTRANSFER, TRUE);//返回内容
|
curl_setopt($resource, CURLOPT_RETURNTRANSFER, TRUE);//返回内容
|
||||||
curl_setopt($resource, CURLOPT_FOLLOWLOCATION, TRUE);// 跟踪重定向
|
curl_setopt($resource, CURLOPT_FOLLOWLOCATION, TRUE);// 跟踪重定向
|
||||||
curl_setopt($resource, CURLOPT_ENCODING, 'gzip,deflate');
|
curl_setopt($resource, CURLOPT_ENCODING, 'gzip,deflate');
|
||||||
|
if ($method === self::POST || $method == self::UPLOAD) {
|
||||||
if ($method === self::POST) {
|
|
||||||
curl_setopt($resource, CURLOPT_POST, 1);
|
curl_setopt($resource, CURLOPT_POST, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user