Crie um arquivo txt com PHP e escreva conteúdo de texto

<!DOCTYPE html>
<html>

<body>

<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "Bill Gates\n";
fwrite($myfile, $txt);
$txt = "Steve Jobs\n";
fwrite($myfile, $txt);
fclose($myfile);
?>
 
</body></html>

Como resultado, uma pasta newfile.txt é criada automaticamente na pasta stiterm, e o conteúdo dentro é

Bill Gates
Steve Jobs

Acho que você gosta

Origin blog.csdn.net/weixin_40945354/article/details/108423581
Recomendado
Clasificación