PHP: 复制和移动图像
PHP: Copying and moving image
如题所示,如何复制图片到哪个目录:
img/user.png
假设我们要将这张图片复制到
user_files/username/putfilehere.png
我发现了一些很长的路线,但我相信它可以通过几行代码来实现。
假设我们的脚本位于目录 /www/ 中,并且您想将图像从 /www/img/user.png 复制到 /www/user_files/username/putfilehere.png。在那种情况下,这很容易做到:
copy('./img/user.png', './user_files/username/putfilehere.png');
如题所示,如何复制图片到哪个目录:
img/user.png
假设我们要将这张图片复制到
user_files/username/putfilehere.png
我发现了一些很长的路线,但我相信它可以通过几行代码来实现。
假设我们的脚本位于目录 /www/ 中,并且您想将图像从 /www/img/user.png 复制到 /www/user_files/username/putfilehere.png。在那种情况下,这很容易做到:
copy('./img/user.png', './user_files/username/putfilehere.png');