Parse the fopen () function in php and use the open file mode description _ PHP
Source: Internet
Author: User
This article provides a detailed analysis of the fopen () function in php using the open file mode description. For more information, see
The fopen () function is used to open a file in PHP. The first parameter of this function contains the name of the file to be opened, and the second parameter specifies the mode used to open the file:
The code is as follows:
$ File = fopen ("welcome.txt", "r ");
?>
The file may be opened in the following mode: R: Read-only. The pointer is located at the beginning of the file. if the file is not reported.
R +: read/write. The pointer is located at the beginning of the file. if the file is not stored, an error is returned.
W: write only. Open and clear the file content. if the file does not exist, create a new file.
W +: read/write. Open and clear the file content. if the file does not exist, create a new file.
A: append. Open the file and locate the pointer at the end of the file. if the file does not exist, create a new file.
A +: Read/append. Open the file and locate the pointer at the end of the file. if the file does not exist, create a new file.
X: Write-only. Create a new file. If the object already exists, FALSE is returned.
X +: read/write. Create a new file. If the file already exists, FALSE and an error are returned.
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.