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