|
Directories, Files and Images
Part:
1
2
3
This chapter describes:
- Directory functions.
- File system functions.
- Image functions.
- ShowPhoto.php - a sample program.
Directory Functions
PHP offers the following built-in functions to manage directories of file systems:
-
chdir -- Change directory
-
chroot -- Change the root directory
-
dir -- Directory class
-
closedir -- Close directory handle
-
getcwd -- Gets the current working directory
-
opendir -- Open directory handle
-
readdir -- Read entry from directory handle
-
rewinddir -- Rewind directory handle
-
scandir -- List files and directories inside the specified path
File System Functions
PHP offers a lots of nice built-in functions to manage files:
-
basename -- Returns filename component of path
-
clearstatcache -- Clears file status cache
-
copy -- Copies file
-
dirname -- Returns directory name component of path
-
disk_free_space -- Returns available space in directory
-
disk_total_space -- Returns the total size of a directory
-
fclose -- Closes an open file pointer
-
feof -- Tests for end-of-file on a file pointer
-
fflush -- Flushes the output to a file
-
fgetc -- Gets character from file pointer
-
fgetcsv -- Gets line from file pointer and parse for CSV fields
-
fgets -- Gets line from file pointer
-
fgetss -- Gets line from file pointer and strip HTML tags
-
file_exists -- Checks whether a file or directory exists
-
file_get_contents -- Reads entire file into a string
-
file_put_contents -- Write a string to a file
-
file -- Reads entire file into an array
-
fileatime -- Gets last access time of file
-
filemtime -- Gets file modification time
-
fileperms -- Gets file permissions
-
filesize -- Gets file size
-
filetype -- Gets file type
-
flock -- Portable advisory file locking
-
fnmatch -- Match filename against a pattern
(Continued on next part...)
Part:
1
2
3
|