PHP readfile() Fucntion and example


 

PHP readfile() Fucntion and example

In this part of the tutorial we will learn about the function readfile() in context of file handling. And we will also see the example related to the readfile() function

In this part of the tutorial we will learn about the function readfile() in context of file handling. And we will also see the example related to the readfile() function

Syntax for PHP readfile() Function
int readfile(file_name[,path_include[,context]])

  • readfile() function] is used to read the file.
  • Then it displays the file contents to the browser using buffer.
  • It returns the no of bytes read.
  • On error it returns the FALSE and display the error message.
  • But if @readfile() function is used then error message will not come.


Example of PHP readfile() Function
Source Code for PHP readfile() Function
<?php

    $a
=readfile("roseindia.txt");
    echo
a;
?>


Output
This site contains many quality Java, JSP Tutorials, Hibernate Tutorials, Struts Tutorials, JSF Tutorials, RMI, MySQL Tutorials, Spring Tutorials, source codes and links to other java resources.

Ads