Home  >  Article  >  Backend Development  >  Understand what a file system is in 5 minutes? What types of functions do they need to create?

Understand what a file system is in 5 minutes? What types of functions do they need to create?

慕斯
慕斯Original
2021-06-08 15:47:041705browse

The previous article introduced you to "What is an anonymous callback?" What is the difference between it and callback function? (With detailed explanation) ", this article will continue to introduce to you what is a file system in 5 minutes? What types of functions do they need to create?

Understand what a file system is in 5 minutes? What types of functions do they need to create?

What is a file system?

  • The file system is just a complete module of PHP knowledge.

  • Any operation on all files requires file system related functions

  • Learning the file system is learning the related functions of operating files

Create file:

--touch()

Parameter 1: File path and name

Parameter 2: Optional parameter modification time

Parameter 3 : Optional parameter access time

Return value: Return true on success, false on failure

Move the file: -Rename

--rename()

Parameter 1: Old file name

Parameter 2: New file name

Return value: Return true on success, false on failure

Delete file:

--unlike()

Parameter: The path of the file to be deleted

Return value: Returns true successfully. Return false on failure

Copy file:

--copy()

Parameter 1: Source file path

Parameter 2: Destination file path

Return value: Return true on success, Returns false on failure

Note: If the target file exists, it will be overwritten.

Get the file size:

--filesize()

Parameter: The file path to get the file size

Return value: Return the size of the file

Determine whether it is a file:

--is_file()

Parameter: File path

Return value: Return true if it is a file, false if it is not a file

Determine whether the file or directory exists:

--file_exists()

Parameters : The path of the file or directory

Return value: Return true if it exists, false if it does not exist;

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of Understand what a file system is in 5 minutes? What types of functions do they need to create?. 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