[英]Copy and rename a folder in PHP
Hi I need to copy a folder in the user registration and will track the new user name in a folder، I found this code on the server but does not work 嗨,我需要在用户注册中复制一个文件夹,并将跟踪文件夹中的新用户名。,我在服务器上找到了此代码,但是不起作用
//Bulder Blog Folder
$Default='blog\Default';
$New='blog\\';
$Blog=$New.$BlogName;
exec("xcopy $Default $Blog /e/i", $a, $a1);
I found the answer 我找到了答案
//Windows Server
$Default='User\Default';
$New='User\'.$_POST['UserAddress'];
exec("xcopy $Default $New /e/i");
//Linux Server
$Default='User/Default';
$New='User/'.$_POST['UserAddress'];
exec("cp -r $Default $New");
Refer to php.net for information. 有关信息,请参考php.net 。
Since copying full folders isn't build in - you should write your own function to do so: 由于没有内置完整文件夹的复制-您应该编写自己的函数来这样做:
If you're too lazy to write this yourself - go here for rcopy . 如果您懒得自己编写此代码,请在这里进行rcopy 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.