Home >Backend Development >PHP Tutorial >PHP simple copy file method code example
This article mainly introduces the method of php to simply copy files, involving PHP's simple determination and reading and writing operations of files. Friends in need can refer to the following
The examples of this article are described A simple way to copy files in php. Share it with everyone for your reference, the details are as follows:
<?php /** *author:果冻 *qq:52091199 *wyg517.blog.163.com **/ $file = 'image/a1.jpg'; $newfile = 'a/123.jpg'; //必须有写入权限 if (file_exists($file) == false) { die ('文件不在,无法复制'); } $result = copy($file, $newfile); if ($result == false) { echo '复制成功'; } ?>
The above is the detailed content of PHP simple copy file method code example. For more information, please follow other related articles on the PHP Chinese website!