Source Code : Write content to file
PHP Is Open Source Programming Language You Can Download and use It, You required xampp server and wamp server . You download From xampp server from https://www.apachefriends.org/download.html.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://php.net/.
Click Here or search from google with Libraries Name you get jar file related it and also http://php.net/ is a official site
Write content to file
<?php
$cfile = "test.txt";
$fh = @fopen($cfile, "r+") or die("<BR>Failed to open file <I>$cfile</I>.");
@flock($fh, LOCK_EX) or die("<BR>Could not lock file <I>$cfile</I>.");
$s = @fgets($fh, 6);
$count = (int) $s + 1;
$count = str_pad($count, 6);
@rewind($fh) or die("<BR>Failed to rewind file <I>$cfile</I>.");
if (@fwrite($fh, $count) == -1) {
die("<BR>Failed to write to file <I>$cfile</I>.");
}
echo "$count";
@flock($fh, LOCK_UN) or die("<BR>Could not unlock file <I>$cfile</I>.");
fclose($fh) or die("<BR>Failed to close file <I>$cfile</I>.");
?>
Thank with us