mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-04 06:12:48 +08:00
注释修改
This commit is contained in:
@@ -50,7 +50,7 @@ class QiniuStorage
|
||||
{
|
||||
$param['deadline'] = 0 == $param['Expires'] ? 3600 : $param['Expires'];
|
||||
$param['deadline'] += time();
|
||||
$data = array('scope' => $this->bucket, 'deadline' => $param['deadline']);
|
||||
$data = ['scope' => $this->bucket, 'deadline' => $param['deadline']];
|
||||
if (!empty($param['CallbackUrl'])) {
|
||||
$data['callbackUrl'] = $param['CallbackUrl'];
|
||||
}
|
||||
@@ -79,15 +79,15 @@ class QiniuStorage
|
||||
|
||||
$url = "{$this->QINIU_UP_HOST}";
|
||||
$mimeBoundary = md5(microtime());
|
||||
$header = array('Content-Type' => 'multipart/form-data;boundary=' . $mimeBoundary);
|
||||
$data = array();
|
||||
$header = ['Content-Type' => 'multipart/form-data;boundary=' . $mimeBoundary];
|
||||
$data = [];
|
||||
|
||||
$fields = array(
|
||||
$fields = [
|
||||
'token' => $uploadToken,
|
||||
'key' => $config['saveName'] ?: $file['fileName'],
|
||||
);
|
||||
];
|
||||
|
||||
if (is_array($config['custom_fields']) && array() !== $config['custom_fields']) {
|
||||
if (is_array($config['custom_fields']) && [] !== $config['custom_fields']) {
|
||||
$fields = array_merge($fields, $config['custom_fields']);
|
||||
}
|
||||
|
||||
@@ -173,12 +173,12 @@ class QiniuStorage
|
||||
}
|
||||
|
||||
//获取某个路径下的文件列表
|
||||
public function getList($query = array(), $path = '')
|
||||
public function getList($query = [], $path = '')
|
||||
{
|
||||
$query = array_merge(array('bucket' => $this->bucket), $query);
|
||||
$query = array_merge(['bucket' => $this->bucket], $query);
|
||||
$url = "{$this->QINIU_RSF_HOST}/list?" . http_build_query($query);
|
||||
$accessToken = $this->accessToken($url);
|
||||
$response = $this->request($url, 'POST', array('Authorization' => "QBox $accessToken"));
|
||||
$response = $this->request($url, 'POST', ['Authorization' => "QBox $accessToken"]);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -188,9 +188,9 @@ class QiniuStorage
|
||||
$key = trim($key);
|
||||
$url = "{$this->QINIU_RS_HOST}/stat/" . self::qiniuEncode("{$this->bucket}:{$key}");
|
||||
$accessToken = $this->accessToken($url);
|
||||
$response = $this->request($url, 'POST', array(
|
||||
$response = $this->request($url, 'POST', [
|
||||
'Authorization' => "QBox $accessToken",
|
||||
));
|
||||
]);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ class QiniuStorage
|
||||
$url = "{$this->QINIU_RS_HOST}/move/" . self::qiniuEncode("{$this->bucket}:{$key}") . '/' . self::qiniuEncode("{$this->bucket}:{$new_file}");
|
||||
trace($url);
|
||||
$accessToken = $this->accessToken($url);
|
||||
$response = $this->request($url, 'POST', array('Authorization' => "QBox $accessToken"));
|
||||
$response = $this->request($url, 'POST', ['Authorization' => "QBox $accessToken"]);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ class QiniuStorage
|
||||
$key = trim($file);
|
||||
$url = "{$this->QINIU_RS_HOST}/delete/" . self::qiniuEncode("{$this->bucket}:{$key}");
|
||||
$accessToken = $this->accessToken($url);
|
||||
$response = $this->request($url, 'POST', array('Authorization' => "QBox $accessToken"));
|
||||
$response = $this->request($url, 'POST', ['Authorization' => "QBox $accessToken"]);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ class QiniuStorage
|
||||
public function delBatch($files)
|
||||
{
|
||||
$url = $this->QINIU_RS_HOST . '/batch';
|
||||
$ops = array();
|
||||
$ops = [];
|
||||
foreach ($files as $file) {
|
||||
$ops[] = "/delete/" . self::qiniuEncode("{$this->bucket}:{$file}");
|
||||
}
|
||||
@@ -236,22 +236,22 @@ class QiniuStorage
|
||||
$url .= '?' . $params;
|
||||
trace($url);
|
||||
$accessToken = $this->accessToken($url);
|
||||
$response = $this->request($url, 'POST', array('Authorization' => "QBox $accessToken"));
|
||||
$response = $this->request($url, 'POST', ['Authorization' => "QBox $accessToken"]);
|
||||
return $response;
|
||||
}
|
||||
|
||||
public static function qiniuEncode($str)
|
||||
{
|
||||
// URLSafeBase64Encode
|
||||
$find = array('+', '/');
|
||||
$replace = array('-', '_');
|
||||
// URLSafeBase64Encode
|
||||
$find = ['+', '/'];
|
||||
$replace = ['-', '_'];
|
||||
return str_replace($find, $replace, base64_encode($str));
|
||||
}
|
||||
|
||||
public static function qiniuEscapequotes($str)
|
||||
{
|
||||
$find = array("\\", "\"");
|
||||
$replace = array("\\\\", "\\\"");
|
||||
$find = ["\\", "\""];
|
||||
$replace = ["\\\\", "\\\""];
|
||||
return str_replace($find, $replace, $str);
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ class QiniuStorage
|
||||
{
|
||||
$ch = curl_init($path);
|
||||
|
||||
$_headers = array('Expect:');
|
||||
$_headers = ['Expect:'];
|
||||
if (!is_null($headers) && is_array($headers)) {
|
||||
foreach ($headers as $k => $v) {
|
||||
array_push($_headers, "{$k}: {$v}");
|
||||
@@ -339,7 +339,7 @@ class QiniuStorage
|
||||
private function response($text)
|
||||
{
|
||||
$headers = explode(PHP_EOL, $text);
|
||||
$items = array();
|
||||
$items = [];
|
||||
foreach ($headers as $header) {
|
||||
$header = trim($header);
|
||||
if (strpos($header, '{') !== false) {
|
||||
|
||||
Reference in New Issue
Block a user