PHP - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

PHP File Handling

PHP File Handling

shape Description

PHP File Handling plays a great role in any web application. Regularly in each and every web application a file can be opened using fopen() and will close the opened files using fclose().

PHP File Manipulation

shape Description

Different operations in file handling are performed by creating, reading, editing and uploading the files. Proper checking is required when working on file manipulations. It is important to check the creation of file and at the time of editing the file. Sometimes improperly editing files leads to loss of the secured data.

PHP readfile() Function

shape Description

Using PHP readfile() function, only read permission can be given to the users.They cannot edit or update the file.

shape Example

example.txt [php] <!DOCTYPE html> <html> <body> <?php echo readfile("random.txt"); ?> </body> </html> [/php] random.txt [php]Hello!! This is SPLessons PHP tutorial. You are reading PHP readfile() function example.[/php] Output:

Summary

shape Key Points

  • File is collection of data.
  • Opening, closing, writing, reading,deleting and renaming are the functions performed on file.