I have this script on one free PHP-supporting server:
<html> <body> <?php $file = fopen("lidn.txt","a"); fclose($file); ?> </body> </html>
It creates the file lidn.txt, but it's empty.
lidn.txt
How can I create a file and write something into it, for example the line "Cats chase mice"?
$fp = fopen('lidn.txt', 'w'); fwrite($fp, 'Cats chase'); fwrite($fp, 'mice'); fclose($fp);
http://php.net/manual/en/function.fwrite.php
It is easy to write file :
$fp = fopen('lidn.txt', 'w'); fwrite($fp, 'Cats chase mice'); fclose($fp);