如何将一个目录移动到另一个目录在PHP? [英] how to move one directory to another directory in php?

查看:123
本文介绍了如何将一个目录移动到另一个目录在PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个文件夹


  1. myappdemo.com/VueGuides/services/iclean

  2. myappdemo .com / VueGuides / services / pics

我需要将 iclean / strong>使用PHP的文件夹。

请指导我。

感谢提前。

解决方案

使用 rename() 。请注意,如果在Web服务器上运行,则Web服务器用户必须有权写入目标目录。

  rename oldpath,newpath); 

//在你的情况下,假设脚本调用rename()
//驻留在myappdemo.com上面的目录
rename(myappdemo.com/VueGuides/ services / iclean,myappdemo.com/VueGuides/services/pics/iclean);

//或使用完整的绝对路径
rename(/ path / myappdemo.com / VueGuides / services / iclean,/path/myappdemo.com/VueGuides/services/pics/我清理);


I have two folders

  1. myappdemo.com/VueGuides/services/iclean
  2. myappdemo.com/VueGuides/services/pics

I need to move iclean folder into pics folder using PHP.

please guide me.

Thanks for advance.

解决方案

Use rename(). Note that if this runs on a web server, the web server user must have access to write to the target directory.

rename("oldpath", "newpath");

// in your case, assuming the script calling rename() 
// resides in the directory above 'myappdemo.com'
rename("myappdemo.com/VueGuides/services/iclean", "myappdemo.com/VueGuides/services/pics/iclean");

// Or use full absolute paths
rename("/path/myappdemo.com/VueGuides/services/iclean", "/path/myappdemo.com/VueGuides/services/pics/iclean");

这篇关于如何将一个目录移动到另一个目录在PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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