
用PHP建立txt文件,并写入文字内容
<?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);
?>
效果,在同文件夹自动建立了一个newfile.txt文件夹,里面的内容是
Bill Gates Steve Jobs
我的微信
我的微信
微信扫一扫
评论