Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the file manipulation functions in PHP

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail what are the file manipulation functions in PHP. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

File operation function

Opendir (path): open a path resource (read all data inside the path into memory)

Readdir (path resource): reads the name of the file pointed to by the current resource pointer from the folder resource, and the pointer moves down one bit.

Closedir (resources): release the corresponding file resources

Scandir (path): reads all the file names within a path and returns an array. Each element of the array is a file name.

File_exists: determine whether a file exists (in a broad sense: path and file)

Is_dir: determines whether a specified path exists (folder)

Is_file: determines whether a specified path is a file (file)

Mkdir: create a path that will report an error if it exists

Rmdir: removing folder

File_get_contents: reads the data contents from a specified file.

File_put_contents: writes the specified string to the corresponding file

Fopen: open a file resource

Fgetc:c stands for character, reading one character at a time

Fgets:s stands for string, which means that multiple characters can be read, depending on the specified read length or whether a newline is encountered (a maximum of one row of data can be read)

Both functions operate on the current resource pointer, and both move the pointer down after reading

Fread: gets the specified length of data until the end of the file

Fwrite: writes data to the location of the file resource pointer. Writing will not move back what already exists in the current location, but will overwrite it.

Fseek: assign the pointer to the corresponding location

Fclose: use the corresponding file resources

Copy: copyin

Unlink: deleting fil

Rename: renaming fil

Filemtime:m stands for modify, and the last time the file was modified

Filesize: file size (bytes)

Fileperms: file permissions (octal under Linux)

What language is php php, a nested acronym, is the abbreviation of English Hypertext preprocessing language (PHP:Hypertext Preprocessor). PHP is a kind of HTML embedded language. PHP is somewhat similar to Microsoft's ASP. It is a scripting language that embeds HTML documents on the server. The style of the language is similar to C language, and now it is widely used by many website programmers.

About "what are the file manipulation functions in PHP" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report