php 打开文件、字段替换、写入文件

35 阅读1分钟
$contents = file_get_contents("phone.vcf");

$str=str_replace(array("\r","\n"),'',$contents);

$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");

fwrite($myfile, $str);
fclose($myfile);