How to use Filesystem file put contents in PHP
In this article I am going to explain about file_put_contents function in PHP.
PHP file_put_contents() function
The filesystem file_put_contents function is used to write a string to a file.
Syntax of file_put_contents function
file_put_contents(path, data, mode, context) |
Parameters in file_put_contents function
It have four parameter:
Parameter |
Description |
file |
It specifies path of the file where to write the data. |
data |
The data to write |
mode |
It specifies mode of the file like open/write. |
context |
It specifies context of the file handle. |
Example of filesystem file_put_contents function
<html>
<body>
<?php
echo file_put_contents("C:\wamp\www\Dinesh\PhpIntro.txt","Life is a gift by God !");
?>
</body>
</html>
|
Output:
You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here