我有两个文件夹

  • myappdemo.com/VueGuides/services/iclean
  • myappdemo.com/VueGuides/services/pics

  • 我需要使用PHP将 iclean 文件夹移动到图片文件夹中。

    最佳答案

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

    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");
    

    10-04 14:22