Files

50 lines
1.4 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
namespace ywxapp\utils\storage;
use think\file\UploadedFile;
/**
* 存储驱动统一接口
* 定义了所有云存储平台必须实现的方法
*/
interface StorageInterface
{
/**
* 上传文件
* @param UploadedFile $file 上传的文件对象
* @param string $path 存储路径
* @param array $options 上传选项
* @return array 包含url、path等信息的结果集
* @throws \Exception
*/
public function upload(UploadedFile $file, string $path, array $options = []): array;
/**
* 删除文件
* @param string $path 文件路径
* @return bool
*/
public function delete(string $path): bool;
/**
* 获取文件访问URL
* @param string $path 文件路径
* @return string
*/
public function getUrl(string $path): string;
/**
* 判断文件是否存在
* @param string $path
* @return bool
*/
public function exists(string $path): bool;
}