重命名目录或文件 [英] rename a directory or a file

查看:94
本文介绍了重命名目录或文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Laravel 5.0 Facades存储

I'm using Laravel 5.0 Facades Storage

使用Illuminate \ Support \ Facades \ Storage;

use Illuminate\Support\Facades\Storage;

我可以像使用它

Storage::..

在Laravel 5.0文档中,没有什么比从存储中重命名文件或文件夹更重要的了.

In the Laravel 5.0 Docs,there's nothing like rename a file or folder from the storage.

有关如何使用存储设备重命名文件或文件夹的任何帮助,想法,线索,建议,建议吗?

Any help, ideas, clues, suggestions, recommendations on how to rename a file or folder using the Storage?

推荐答案

Laravel文档

移动方法可用于重命名或将现有文件移动到新位置:

The move method may be used to rename or move an existing file to a new location:

Storage::move('hodor/file1.jpg', 'holdthedoor/file2.jpg');

这样,您无需移动即可重命名

this way, you can rename without moving

Storage::move('hodor/oldfile-name.jpg', 'hodor/newfile-name.jpg'); // keep the same folder to just rename 

来源

这篇关于重命名目录或文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆