1 | <?php |
||
4 | final class Config |
||
5 | { |
||
6 | const SDK_VER = '7.2.5'; |
||
7 | |||
8 | const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改 |
||
9 | |||
10 | const RSF_HOST = 'rsf.qiniu.com'; |
||
11 | const API_HOST = 'api.qiniu.com'; |
||
12 | const RS_HOST = 'rs.qiniu.com'; //RS Host |
||
13 | const UC_HOST = 'https://api.qiniu.com'; //UC Host |
||
14 | const RTCAPI_HOST = 'http://rtc.qiniuapi.com'; |
||
15 | const ARGUS_HOST = 'argus.atlab.ai'; |
||
16 | const RTCAPI_VERSION = 'v3'; |
||
17 | |||
18 | // Zone 空间对应的机房 |
||
19 | public $zone; |
||
20 | //BOOL 是否使用https域名 |
||
21 | public $useHTTPS; |
||
22 | //BOOL 是否使用CDN加速上传域名 |
||
23 | public $useCdnDomains; |
||
24 | // Zone Cache |
||
25 | private $zoneCache; |
||
26 | |||
27 | // 构造函数 |
||
28 | 69 | public function __construct(Zone $z = null) |
|
35 | |||
36 | 18 | public function getUpHost($accessKey, $bucket) |
|
52 | |||
53 | public function getUpBackupHost($accessKey, $bucket) |
||
54 | { |
||
55 | $zone = $this->getZone($accessKey, $bucket); |
||
56 | if ($this->useHTTPS === true) { |
||
57 | $scheme = "https://"; |
||
58 | } else { |
||
59 | $scheme = "http://"; |
||
60 | } |
||
61 | |||
62 | $host = $zone->cdnUpHosts[0]; |
||
63 | if ($this->useCdnDomains === true) { |
||
64 | $host = $zone->srcUpHosts[0]; |
||
65 | } |
||
66 | |||
67 | return $scheme . $host; |
||
68 | } |
||
69 | |||
70 | public function getRsHost($accessKey, $bucket) |
||
82 | |||
83 | public function getRsfHost($accessKey, $bucket) |
||
95 | |||
96 | 6 | public function getIovipHost($accessKey, $bucket) |
|
108 | |||
109 | public function getApiHost($accessKey, $bucket) |
||
121 | |||
122 | 24 | private function getZone($accessKey, $bucket) |
|
137 | } |
||
138 |