Answers for "write contents to file php"

PHP
9

write to file php

$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, "Content to write to file");
fclose($myfile);
Posted by: Guest on October-22-2020
5

php write to file

$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Bobby Bopper\n";
fwrite($fh, $stringData);
$stringData = "Tracy Tanner\n";
fwrite($fh, $stringData);
fclose($fh);
Posted by: Guest on February-24-2020
1

write file in php

// if not file is there then automatic create and write inside it.
$fptr = fopen('myfile.txt','w');
fwrite($fptr,"i am writing file in this\n");
fwrite($fptr,'writing another line.');
fclose($fptr);
Posted by: Guest on October-12-2021

Browse Popular Code Answers by Language