config['access_key_id'], $this->config['access_key_secret'], $this->config['domain'], true ); $result = $ossClient->uploadFile( $this->config['bucket'], $this->getSaveFileInfo()['file_path'], $this->getRealPath() ); } catch (OssException $e) { $this->error = $e->getMessage(); return false; } return true; } /** * 删除文件 * @param string $fileName * @return bool|mixed */ public function delete(string $fileName) { try { $ossClient = new OssClient( $this->config['access_key_id'], $this->config['access_key_secret'], $this->config['domain'], true ); $ossClient->deleteObject($this->config['bucket'], $fileName); } catch (OssException $e) { $this->error = $e->getMessage(); return false; } return true; } }