Tools, FAQ, Tutorials:
Writing a String to a File with a File Handle in PHP
How To Write a String to a File with a File Handle in PHP?
✍: FYIcenter.com
If you have a file handle linked to a file opened for writing, and you want to write a string to the file, you can use the fwrite() function. It will write the string to the file where the file pointer is located, and moves the file pointer to the end of the string. Here is a PHP script example on how to use fwrite():
<?php
$file = fopen("/temp/todo.txt", "w");
fwrite($file,"Download PHP scripts at dev.fyicenter.com.\r\n");
fwrite($file,"Download Perl scripts at dev.fyicenter.com.\r\n");
fclose($file);
?>
This script will write the following to the file:
Download PHP scripts at dev.fyicenter.com. Download Perl scripts at dev.fyicenter.com.
⇒ Writing a String to a File without a File Handle in PHP
⇐ Reading a File in Binary Mode in PHP
2016-11-27, ∼2950🔥, 0💬
Popular Posts:
How to use the Atom Online Validator at w3.org? w3.org feed validation service is provided at http:/...
How to attach console to a Running Container using the "docker container exec" command? I want to ge...
How to use the "rewrite-uri" Policy Statement for an Azure API service operation? The "rewrite-uri" ...
Where to get a JSON.stringify() Example Code in JavaScript? Here is a good JSON.stringify() example ...
What Is session_register() in PHP? session_register() is old function that registers global variable...