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

PHP simple copy file method code example

怪我咯
怪我咯Original
2017-07-09 09:33:561805browse

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;;
  }
?>

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!

Statement:
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