Step by step to learn how to develop File System instances in PHP
Source: Internet
Author: User
Step by step to learn how to develop a file system instance in PHP-general Linux technology-Linux programming and kernel information. The following is a detailed description. PHP has many functions related to the file system. These functions can not only open files, but also display contents in directories, move files, and other functions, many people even use PHP to develop Internet-based file resource managers.
The following script example shows a directory list with annotations included in the Code:
$ Dir_name = "/home/me /";
/? Create a handle whose value is the result of opening a given directory? /
$ Dir = opendir ($ dir_name );
/? Create a text block to place the list element (File Name )? /
$ File_list =" /? Use a while statement to read all the elements in the opened directory. If the file name is not "." or "...", the name/
While ($ file_name = readdir ($ dir )){
If ($ file_name! = ".") & ($ File_name! = "..")){
$ File_list. =" }
}
$ File_list. ="/? Close the opened directory and end the PHP module? /
Closedir ($ dir );
?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service