//实例化类 传入当前控制器的app类
$file = new Filesystem($this->app);
/**
* config/filesystem.php 配置文件系统路径。
* disk('public) 是选取config/filesystem.php 里面的public配置,可以省略disk,如果省略默认就是runtime/storage路径。
*/
$getMetadata = $file->disk('public')->getMetadata('20220509.png');//获取元数据
$getSize = $file->disk('public')->getSize('20220509.png');//获取大小
$getTimestamp = $file->disk('public')->getTimestamp('20220509.png');//获取时间戳
// $getWithMetadata = $file->disk('public')->getWithMetadata('20220509.png', $getMetadata);
$listContents = $file->disk('public')->listContents('topic');//列出目录下的内容
dump($listContents);
$delete = $file->disk('public')->delete('topic');//删除文件
$putFile = $file->disk('public')->putFile('', $image);//保存文件
$putFileAs = $file->disk('public')->putFileAs('', $image);//指定文件名保存文件
$putStream = $file->disk('public')->putStream('', $image);//创建文件或更新(如果存在)
$putStream = $file->disk('public')->put('', $image);//创建文件或更新(如果存在).<br><br>
$write = $file->disk('public')->write('text\zhoage.text', '这是内容');//写入文件
$write = $file->disk('public')->createDir('zhao');//创建目录
$write = $file->disk('public')->rename('text\zhoage.text','zhao.txt');//修改文件名称
$write = $file->disk('public')->has('zhao.txt');//检查文件是否存在
$write = $file->disk('public')->read('zhao.txt');//读取文件
$write = $file->disk('public')->update('zhao.txt','这是更新后的内容');//修改现有文件
$write = $file->disk('public')->copy('zhao.txt','zhaoge/fuzhi.txt');//复制文件