How to use fopen in PHP
In this article I will go to explain about fopen function in PHP.
PHP fopen() function
The PHP fopen() is used to open a file in PHP to performing read, write, or rewrite operations.
Syntax of fopen function
fopen("filename","mode");
|
Parameters in fopen function
It have two parameters.
-
r-
It is used for reading a file from beginning.
-
r+
It is used for reading and writing a file from beginning.
-
w-
It is used for writing a file from beginning.
-
w+
It is used for writing and reading a file from beginning.
-
a-
It is used for writing a file from end.
Example of fopen function
<html>
<body>
<?php
$file=fopen("sharad.txt","r-") or exit("Unable to open file!");
?>
</body>
</html>
|
You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here