Home  >  Article  >  Backend Development  >  A brief analysis of how to move files or folders in PHP

A brief analysis of how to move files or folders in PHP

WBOY
WBOYOriginal
2016-07-25 08:52:201011browse
  1. rename("D:/logs/write/theme/history","F:/logs/write/theme/history");
  2. ?>
Copy code

Test analysis: For a 40M file, the copy+unlink method takes 7.6249899864197 seconds; The rename method only requires 0.024738788604736, which is 300 times faster.

Recommendation: Use the copy+unlink method with caution, and use the rename method to move files and folders.



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