File Operation Functions

Source: Internet
Author: User

The file operation functions in PHP3.0 are similar to those in C, but there are some extensions, especially in addition to the support
In addition to accessing local files, you can also access HTTP and FTP URLs. You only need to pass these URLs as file names to file operation functions.
The main file operation functions are:
(1) fclose, feof, fgetc, fgets, fopen, fputs, fseek, ftell, mkdir, readlink, rename, rewind, rmdir, stat, unlink
These functions are similar to functions with the same name in C.
 
(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 );
Note that these functions use the file name instead of 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, available
These are file information functions. Most of them accept a file name as a parameter.
 
(4) fgetss
Usage:
Fgetss (file number, maximum length );
Read a row of the file or until the maximum length (similar to fgets), but remove all HTML and PHP markup.
 
(5) file
Usage:
File (file Name );
Returns an array. Each element is a row in the file.
 
(6) tempnam
Usage:
Tempnam (directory name, prefix );
Returns a temporary file name.


 
(7) basename, dirname
Obtain the part of the file name and directory name in the file path. in Windows, "/" and "" can both be used as Directory delimiters. In other systems, only "/" is allowed.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.