thinkphp6使用阿里云oss上傳大文件或視頻太慢
thinkphp6使用阿里云oss上傳大文件或視頻太慢如何處理
購買服務(wù)器和創(chuàng)建oss 要在一個區(qū)域,例如購買服務(wù)器是華北3,創(chuàng)建oss 也要是華北3區(qū),這樣上傳會加快很多
設(shè)置上傳域名位 .oss-cn-zhangjiakou-internal.aliyuncs.com
$options = array( OssClient::OSS_CHECK_MD5 => true, OssClient::OSS_PART_SIZE => 10 * 1024, ); $object = $name . date('Y-m-d', time()) . '/' . $arrList1; try { $ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint, true); $info = $ossClient->multiuploadFile($this->bucket, $object, $file, $options); if ($info['info']['url']) { $url = substr($info['info']['url'], 0, strrpos($info['info']['url'], "?")); return $url; } else { return false; } } catch (OssException $e) { printf(__FUNCTION__ . ": FAILED\n"); printf($e->getMessage() . "\n"); return; }
[聲明]原創(chuàng)不易,請轉(zhuǎn)發(fā)者備注下文章來源(hbsjsd.cn)【速建時代】。