PHP file Operations

Source: Internet
Author: User

      fopen (Filename,mode,include_path,context)
mode description
"R" read-only opens, pointing the file pointer to the file header.
"r+" read-write mode opens, pointing the file pointer to the file header.
"W" write open, pointing the file pointer to the file header and truncating the file size to zero. If the file does not exist, try to create it.
"w+" read-write mode opens, pointing the file pointer at the file header and truncating the file size to zero. If the file does not exist, try to create it.
"A" write open, pointing the file pointer to the end of the file. If the file does not exist, try to create it.
"A +" read-write mode opens, pointing the file pointer at the end of the file. If the file does not exist, try to create it. The
"x"

is created and opened as a write, pointing the file pointer to the file header. If the file already exists, the fopen () call fails and returns false, and generates an E_warning level error message. If the file does not exist, try to create it.

This and specify o_excl| for the underlying open (2) system call The o_creat tag is equivalent.

This option is supported by PHP 4.3.2 and later versions and can only be used on local files. The

"x+"

is created and opened as read-write, pointing the file pointer to the file header. If the file already exists, the fopen () call fails and returns false, and generates an E_warning level error message. If the file does not exist, try to create it.

This and specify o_excl| for the underlying open (2) system call The o_creat tag is equivalent.

This option is supported by PHP 4.3.2 and later versions and can only be used on local files.

In PHP mode only above the settings of the table, other operations are not valid, such as "RW", "RB", "rw+" and other combinations.

In the PHP regular expression matching function preg_match

The lookup file conforms to cst+8 or cst+08:00 or cst-08:00 through this regular expression cst\d\d{1,2}\d?\d{0,2} can be found.

Regular expressions are commonly used characters that need not be deeply understood, unless a large number of projects require

\d integers, \d characters, + repeats more than once, repeat 0 or 1 times, * Repeat 0 or more times, {n,m} repeats n to M times, [] matches what appears in parentheses.

The limitation of IP is that the maximum value cannot exceed 256, and the regular expression design is based on this principle.

IP: ((25[0-5]|2[0-4]\d|[ 0,1]?\d\d?) \.) {3} (25[0-5]|2[0-4]\d| [0,1]?\d\d?]

e-mail Regular expression: http://blog.csdn.net/fatherican/article/details/8853062

PHP file Operations

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.