Home Tutorial Php Phpfiles PHP readfile() Fucntion and example

 
 

Share on Google+Share on Google+
PHP readfile() Fucntion and example
Posted on: October 30, 2009 at 12:00 AM
Advertisement
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.
Advertisement

Related Tags for PHP readfile() Fucntion and example :


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 30, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com