Home > Backend Development > PHP Tutorial > PHP simple copy file method code example

PHP simple copy file method code example

怪我咯
Release: 2023-03-13 09:10:01
Original
1788 people have browsed it

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 = &#39;image/a1.jpg&#39;;
$newfile = &#39;a/123.jpg&#39;; //必须有写入权限
  if (file_exists($file) == false)
  {
   die (&#39;文件不在,无法复制&#39;);
  }
  $result = copy($file, $newfile);
  if ($result == false)
  {
   echo &#39;复制成功&#39;;
  }
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template