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

Basic operation of PHP file directory

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

Share

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

This article mainly explains the "basic operation of the PHP file directory", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn the "basic operation of the PHP file directory" bar!

1. Get the attribute information of the file

First of all, files have types. Under Linux, there are block (block devices, such as disk partitions, CD-ROM), char (devices input by characters, such as keyboards, printers), dir (directory types, directories are also a kind of files), fifo (named pipes, which means passing information from one process to another), file (ordinary files), and link (links). Similar to the shortcuts under win), unknow (unknown type) 7 categories, under win, there are only 3 categories: file, dir and unknown. Linux scum said that we must do a good job on Linux-_-,. The family was born for Linux.

There are several functions for type acquisition: filetype: get the type; is_file: determine whether it is a normal file; is_link: determine whether it is a link.

There are several functions for getting attributes:

File_exists: determines whether a file or directory exists

Filesize: get file size

Is_readable, is_writable, is_executable: readable, writable, executable

Filectime, filemtime, fileatime: get the creation time (create), modification time (modify) and access time (access) of the file, and all return timestamps

Stat: gets some basic information about the file and returns a mixed array of indexes and associations.

For example, you can determine the file type as follows:

The copy code is as follows:

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

*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