PHP File Operation open mode

Source: Internet
Author: User

Open 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-only opens, 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 to the file header and truncating the file size to zero.

If the file does not exist, try to create it.

X

Creates and opens in writing, 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.

x+

Creates and opens read-write, pointing the file pointer to the file header. If the file already exists, the

fopen (the call fails and returns false, and generates an E_warning level error message.)

If the file does not exist, try to create it.

A

Write to 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 to the end of the file.

If the file does not exist, try to create it.

B

Opens in binary mode for connection to other modes. If the file system can differentiate between binary

Files and text files that you may use. Windows systems can differentiate, while UNIX does not

Distinguish. It is recommended to use this option all the time for maximum portability. It is also the default

The mode.

T

Opens in text mode for use in conjunction with other modes. This mode is only the Windows system

An option. It is not a recommended option unless you have used the B option in your code.

PHP File Operation open mode

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.