@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $_headers = array('Expect:'); |
336 | 336 | $date = $this->currentMilliSecond(); //得到当前的时间戳,毫秒 |
337 | 337 | array_push($_headers, "Date: {$date}"); |
338 | - $authorization = $this->getAuthorization($uri, $date, $httpBody); //Http的Body需要加入管理鉴权 |
|
338 | + $authorization = $this->getAuthorization($uri, $date, $httpBody); //Http的Body需要加入管理鉴权 |
|
339 | 339 | array_push($_headers, "Authorization: {$authorization}"); |
340 | 340 | array_push($_headers, "User-Agent: {$this->getUserAgent()}"); |
341 | 341 | if (!is_null($headers) && is_array($headers)) { |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | array_push($_headers, "Content-Type: application/x-www-form-urlencoded"); |
355 | 355 | } |
356 | 356 | array_push($_headers, "Content-Length: {$length}"); |
357 | - curl_setopt($ch, CURLOPT_HEADER, 1); //设置头部 |
|
358 | - curl_setopt($ch, CURLOPT_HTTPHEADER, $_headers); //请求头 |
|
359 | - curl_setopt($ch, CURLOPT_TIMEOUT, Conf::HTTP_TIMEOUT); //超时时长 |
|
360 | - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); //连接超时时长 |
|
357 | + curl_setopt($ch, CURLOPT_HEADER, 1); //设置头部 |
|
358 | + curl_setopt($ch, CURLOPT_HTTPHEADER, $_headers); //请求头 |
|
359 | + curl_setopt($ch, CURLOPT_TIMEOUT, Conf::HTTP_TIMEOUT); //超时时长 |
|
360 | + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); //连接超时时长 |
|
361 | 361 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //成功,只返回结果,不自动输出任何内容。如果失败返回FALSE |
362 | 362 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); |
363 | - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); //自定义请求 |
|
363 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); //自定义请求 |
|
364 | 364 | //设置请求方式(GET或POST等) |
365 | 365 | if ($method == 'PUT' || $method == 'POST') { |
366 | 366 | curl_setopt($ch, CURLOPT_POST, 1); |
@@ -375,10 +375,10 @@ discard block |
||
375 | 375 | } else { |
376 | 376 | //解析返回结果,并判断是否上传成功 |
377 | 377 | $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
378 | - $success = ($http_code == 200) ? true : false; //判断是否上传成功 |
|
378 | + $success = ($http_code == 200) ? true : false; //判断是否上传成功 |
|
379 | 379 | $resStr = explode("\r\n\r\n", $response); |
380 | 380 | $resBody = isset($resStr[1]) ? $resStr[1] : ''; |
381 | - $resArray = json_decode($resBody, true); //解析得到结果 |
|
381 | + $resArray = json_decode($resBody, true); //解析得到结果 |
|
382 | 382 | $result = (empty($resArray)) ? array() : $resArray; |
383 | 383 | } |
384 | 384 | } catch (Exception $e) { |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | protected function currentMilliSecond() |
451 | 451 | { |
452 | 452 | list($microSec, $stampSec) = explode(' ', microtime()); |
453 | - $tempMilli = sprintf('%03s', intval($microSec * 1000)); |
|
453 | + $tempMilli = sprintf('%03s', intval($microSec * 1000)); |
|
454 | 454 | $currentMilli = $stampSec . $tempMilli; |
455 | 455 | return $currentMilli; |
456 | 456 | } |