cqpCow пре 1 година
родитељ
комит
873e3fd86f
1 измењених фајлова са 10 додато и 0 уклоњено
  1. 10 0
      app/Service/OssService.php

+ 10 - 0
app/Service/OssService.php

@@ -129,4 +129,14 @@ class OssService extends Service
 
         return $url;
     }
+
+    // 阿里云上是否存在图片
+    public function isIsset($objectKey){
+        // 初始化OSS客户端
+        $ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint);
+
+        if ($ossClient->doesObjectExist($this->bucket, $objectKey)) return true;
+
+        return false;
+    }
 }