Home >Backend Development >PHP Tutorial >A simple way to copy files in php, _PHP tutorial
The example in this article describes how to simply 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 '复制成功'; } ?>
Readers who are interested in more PHP related content can check out the special topics of this site: "Summary of PHP File Operations", "Summary of PHP Operations and Operator Usage", "Summary of PHP Network Programming Skills", "Introduction Tutorial on PHP Basic Grammar" ", "Summary of PHP office document operation skills (including word, excel, access, ppt)", "Summary of PHP date and time usage", "Introduction to PHP object-oriented programming tutorial", "Summary of PHP string (string) usage" , "Introduction Tutorial on PHP MySQL Database Operation" and "Summary of Common PHP Database Operation Skills"
I hope this article will be helpful to everyone in PHP programming.