1 打开一个文件替换指定内容后再次写入最节省资源的方法: <?php $f='a.html'; file_put_contents($f,str_replace('[我的电脑]','PHP学习',file_get_contents($f))); ?>