Skip to content

Commit

Permalink
自动处理时区
Browse files Browse the repository at this point in the history
  • Loading branch information
eddy8 committed Apr 26, 2019
1 parent d36c767 commit 7d93462
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ composer require eddy/aliyuncdn

## 使用方法
```
// 时区设置
date_default_timezone_set('UTC');
// 实例化客户端
$client = new eddy\AliYunCDNClient('key', 'secret');
// 发送请求
Expand Down
3 changes: 3 additions & 0 deletions src/AliYunCDNClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public function __construct($key = '', $secret = '')
$this->key = $key;
$this->secret = $secret;
$this->httpClient = new Client();
$orginTimeZone = date_default_timezone_get();
date_default_timezone_set('UTC');
$this->common_params = [
'Format' => 'JSON',
'Version' => '2014-11-11',
Expand All @@ -32,6 +34,7 @@ public function __construct($key = '', $secret = '')
'SignatureVersion' => '1.0',
'SignatureNonce' => uniqid(),
];
date_default_timezone_set($orginTimeZone);
}

public function __call($name, $arguments)
Expand Down

0 comments on commit 7d93462

Please sign in to comment.