Answers for "appendfile in php"

PHP
1

append file in php

$fptr = fopen('myfile2.txt','a');
fwrite($fptr,"hii.. this is appending inside filen")
fclose($fptr);
Posted by: Guest on October-12-2021
1

php append file

<?php

$file = 'myFile.txt';
$text = "This is my Textn";
file_put_contents($file, $text, FILE_APPEND | LOCK_EX);

// adds "This is my Text" and a linebreak to the end of "myFile.txt"
// "LOCK_EX" prevents anyone else writing to the file at the same time

?>
Posted by: Guest on September-15-2021

Browse Popular Code Answers by Language