File manipulation Functions _php Tutorial

Source: Internet
Author: User
The file manipulation functions in PHP3.0 are broadly similar to those of C, but there are some extensions, especially in addition to supporting
Access to native files is also supported for HTTP and FTP URLs, as long as the URLs are passed as filenames to the file manipulation function.
The main file manipulation functions are:
(1) fclose, feof, fgetc, Fgets, fopen, fputs, Fseek, Ftell, mkdir, Readlink, rename, rewind, rmdir, stat, unlink
These functions are similar to the functions of the same name in the 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 is important to note that these functions use filenames instead of the file numbers 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);
Reads a line of files or until the maximum length (similar to fgets), but removes all HTML and PHP tags.
 
(5) file
Usage:
File (file name);
Returns an array with each element being a row in the file.
 
(6) Tempnam
Usage:
Tempnam (directory name, prefix);
Returns a temporary file name.

 
(7) basename, dirname
Gets the file name part and the directory name part of the path to the files. Under Windows systems, both "/" and "" can be used as directory separators, and only "/" is available under other systems.

http://www.bkjia.com/PHPjc/531987.html www.bkjia.com true http://www.bkjia.com/PHPjc/531987.html techarticle the file operation function in PHP3.0 is similar to that of C, but there are some extensions, especially in addition to support the access to native files, and also support the HTTP and FTP URLs, as long as the URL as ...

  • 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.