How to use Filesystem fopen in PHP

In this article I am going to explain about fopen function in PHP.
  • 1394

PHP fopen() Function

The filesystem fopen function is used to open a file or URL.


Syntax of fopen function

fopen(fileName, mode,  includePath, context)

Parameters in fopen  function

It have four parameter:

Parameter Description
fileName It specifies the file to open.
mode The mode parameter specifies the type of access you require to the stream.
includePath You can set the parameter 1 if you want to search for the file in the includePath.
context It specifies the context of the file handle.

Example of filesystem fopen function

<html>

<body>
 

<?php

$file1 = fopen("C:\wamp\www\Dinesh\Mcn.txt","w+");

$file2 = fopen("C:\wamp\www\Dinesh\Mcn.txt","r");

$file3 = fopen("C:\wamp\www\Dinesh\Mcn.txt","r+");

$file4 = fopen("C:\wamp\www\Dinesh\Mcn.txt","a");

?>
 

</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

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.