The file operation functions in PHP3.0 are generally similar to those in C, but there are some extensions. In particular, in addition to supporting
access to local files, it also supports access to HTTP and FTP URLs. As long as these URLs are used as files Just pass the name to the file operation function.
The main file operation functions are:
(1)fclose, feof, fgetc, fgets, fopen, fputs, fseek, ftell, mkdir, readlink, rename, rewind, rmdir, stat, unlink
The functions of these functions are similar to the functions of the same name in C language.
(2)chgrp, chmod, chown, copy
The meanings of these functions are also easy to understand:
chgrp (file name, group);
chmod (file name, mode);
chown (file name, user);
copy (source file name, target file name);
It should be noted that these functions use the file name rather than the file number returned by fopen.
(3)file_exists, fileatime, filectime, filegroup, fileinode, filemtime, fileowner, filesize, filetype, fileperms, fileumask , is_dir, is_executable, is_file, is_link, is_readable, is_writeable
These are file information functions, most of which accept a file name as a parameter.
(4)fgetss
Usage:
fgetss(file number, maximum length);
Read one line of the file or up to the maximum length (similar to fgets), but remove all HTML and PHP tags.
(5)file
Usage:
file(file name);
Returns an array, each element is a line in the file.
(6)tempnam
Usage:
tempnam(directory name, prefix);
Return a temporary file name.