Home > Backend Development > PHP Tutorial > File operation functions_PHP tutorial

File operation functions_PHP tutorial

WBOY
Release: 2016-07-13 17:26:19
Original
871 people have browsed it

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.



(7)basename, dirname
Get the file name part and directory name part of the file path. Under Windows system, "/" and "" Both can be used as directory separators. In other systems, only "/" can be used.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531987.htmlTechArticleThe file operation functions in PHP3.0 are generally similar to those in C, but there are some extensions, especially in addition to supporting this In addition to accessing machine files, it also supports access to HTTP and FTP URLs. Just use these URLs as...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template