PHP function fopen and example
In this segment of PHP tutorial we will learn about the PHP fopen() function and its example
In this segment of PHP tutorial we will learn about the PHP fopen() function and its example
Syntax
file_handler
fopen(file_name,file_mode,[path_include,[context]])
- It opens the given file with the given mode and return the
file
handler
- Using this file handler all other file handling functions can be
done
- In write (w) mode it creates a new file ,but not in read(r,r+),append(a)mode.
Example of PHP fopen() Function
Code for PHP fopen() Function
<?php
$file1=fopen(
"c:/rose1/ram.txt",
"r");
if(!
$file1)
echo "file is
not existing ";
else
echo "file
exists";
?>
Output
file exists