|
|
|
@ -17,8 +17,6 @@
|
|
|
|
|
namespace DtApp\ThinkLibrary\service\ksyun;
|
|
|
|
|
|
|
|
|
|
use DtApp\ThinkLibrary\Service;
|
|
|
|
|
use Ks3Client;
|
|
|
|
|
use Ks3ServiceException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 金山云对象存储
|
|
|
|
@ -78,19 +76,8 @@ class Ks3Service extends Service
|
|
|
|
|
if (empty($this->accessKeyID)) $this->getConfig();
|
|
|
|
|
if (empty($this->accessKeySecret)) $this->getConfig();
|
|
|
|
|
if (empty($this->endpoint)) $this->getConfig();
|
|
|
|
|
//是否使用VHOST
|
|
|
|
|
define("KS3_API_VHOST", FALSE);
|
|
|
|
|
//是否开启日志(写入日志文件)
|
|
|
|
|
define("KS3_API_LOG", TRUE);
|
|
|
|
|
//是否显示日志(直接输出日志)
|
|
|
|
|
define("KS3_API_DISPLAY_LOG", TRUE);
|
|
|
|
|
//定义日志目录(默认是该项目log下)
|
|
|
|
|
define("KS3_API_LOG_PATH", "");
|
|
|
|
|
//是否使用HTTPS
|
|
|
|
|
define("KS3_API_USE_HTTPS", FALSE);
|
|
|
|
|
//是否开启curl debug模式
|
|
|
|
|
define("KS3_API_DEBUG_MODE", FALSE);
|
|
|
|
|
$client = new Ks3Client($this->accessKeyID, $this->accessKeySecret, $this->endpoint);
|
|
|
|
|
require_once(__DIR__ . "/bin/Ks3Client.class.php");
|
|
|
|
|
$client = new \Ks3Client($this->accessKeyID, $this->accessKeySecret, $this->endpoint);
|
|
|
|
|
if (empty($this->bucket)) $this->getConfig();
|
|
|
|
|
$content = fopen($filePath, "r");
|
|
|
|
|
$args = [
|
|
|
|
@ -115,7 +102,7 @@ class Ks3Service extends Service
|
|
|
|
|
try {
|
|
|
|
|
$client->putObjectByFile($args);
|
|
|
|
|
return $this->app->config->get('dtapp.ksyun.ks3.url') . $object;
|
|
|
|
|
} catch (Ks3ServiceException $e) {
|
|
|
|
|
} catch (\Ks3ServiceException $e) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|