chdir: change directory.
dir: Directory category class.
closedir: Close the directory handle.
opendir: open directory handle.
readdir: read directory handle.
rewinddir: Reset directory handle.
chdir
Change directory.
Syntax: int chdir(string directory);
Return value: integer
Function type: file access
Content description This function is used to change the current directory where php is executed to a new directory. Returns false if it cannot be changed, returns true if successful.
dir
Directory category class.
Syntax: new dir(string directory);
Return value: Class
Function type: File access
Content description This is a similar object-oriented category class, used to read directories. When the directory parameter directory is opened, two attributes are available: the handle attribute is like readdir(), rewinddir() and closedir() used by other non-class functions; the path attribute configures the path parameter after opening the directory. This class has three methods: read, rewind and close.
Usage example
$d = dir("/etc");
echo "handle: ".$d->handle."
n";
echo "path: ".$d ->path."
n";
while($entry=$d->read()) {
echo $entry."
n";
}
$d-> close();
?>
closedir
Close the directory handle.
Syntax: void closedir(int dir_handle);
Return value: None
Function type: File access
Content description
This function is used to close the dir_handle of the directory data stream. The directory operated by this dir_handle parameter must be opened by opendir() before it can be used.
opendir
Open directory handle.
Syntax: int opendir(string path);
Return value: integer
Function type: file access
Content description
This function is used to open the directory data stream. The returned integer is a handle that can be manipulated by other directory functions.
readdir
Read directory handle.
Syntax: string readdir(int dir_handle);
Return value: string
Function type: file access
Content description This function is used to read the directory. Returns the names of files in a directory, read without any special order.
Usage example: List all files in the current directory
$handle=opendir('.');
echo "Directory handle: $handlen";
echo "File:n";
while ($ file = readdir($handle)) {
echo "$filen";
}
closedir($handle);
?>
rewinddir
Reset directory handle.
Syntax: void rewinddir(int dir_handle);
Return value: None
Function type: File access
Content description This function is used to reset the directory data flow to the beginning.
The above has introduced a summary of the PHP catalog management functions of the National Basic Medical Insurance and Work Injury Insurance Drug Catalog, including the content of the National Basic Medical Insurance and Work Injury Insurance Drug Catalog. I hope it will be helpful to friends who are interested in PHP tutorials.