WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

PHP 5 File Handling


File taking care of is an imperative piece of any web application. You regularly need to open and process a document for various tasks.


PHP Manipulating Files

PHP has a few capacities for making, perusing, transferring, and altering files.


PHP readfile() Function

The readfile() work peruses a document and composes it to the yield buffer.

Assume we have a content document called "webdictionary.txt", put away on the server, that resembles this:

AJAX = Asynchronous JavaScript and XML
CSS = Cascading Style Sheets
HTML = Hyper Text Markup Language
PHP = PHP Hypertext Preprocessor
SQL = Structured Query Language
SVG = Scalable Vector Graphics
XML = EXtensible Markup Language

The PHP code to peruse the document and compose it to the yield cradle is as per the following (the readfile() work restores the quantity of bytes read on success):

Example

<?php
echo readfile("webdictionary.txt");
?>
Run model »