Using PHP function Glob to find the file path matching the pattern, mainly discusses the function and usage of glob () functions, using the GLOB function to read the directory faster than the others, because the Glob function is the built-in
PHP uses the Glob function to quickly query the method of the specified directory file,
This example describes how PHP uses the Glob function to quickly query a specified directory file. Share to everyone for your reference. Specific as
This example describes how PHP uses the Glob function to traverse a directory or folder. Share to everyone for your reference. The specific analysis is as follows:
When it comes to PHP traversal directory Many of our friends will think of Opendir
This example describes how PHP uses the Glob function to quickly query a specified directory file. Share to everyone for your reference. Specific as follows:
PHP searches the current directory for all files, the code is as follows:
$array = Glob ('
This example describes how PHP uses the Glob function to quickly query for a specified directory file. Share to everyone for your reference. Specifically as follows:
PHP searches the current directory for all files, code as follows:
Copy Code
Traversing all files under a folder, you can generally use the Opendir and Readdir methods to traverse.
Example: Find all the PHP files in the specified directory (do not search subfolders), the code is as follows:
$path = dirname(__FILE_
PHP uses the Glob function to implement a word delete all files under a directory,
Collected from online:Copy the Code code as follows:Array_map (' unlink ', glob (' * '));A lot of friends may not know the function of Glob. Read the manual for more
Collected from the Internet:
Copy Code code as follows:
Array_map (' unlink ', glob (' * '));
A lot of friends may not know glob this function. See the Manual for more usage.
PHP Glob () function
Definitions and usage
The
* ** Test the folder command and copy the installation directory of a program to the project * traverse all directories and files in the specified directory * readdir () the function returns the file name * is_dir () of the next file in the
Definition and usage
The glob () function returns a file name or directory that matches the specified mode.
This function returns an array containing matching files/directories. If an error occurs, false is returned.Syntax
glob(pattern,flags)
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.