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;
+    }
 }