标签:
<?php
$fp=fopen(‘ffff.txt‘,‘r‘);
$str=fread($fp,filesize("ffff.txt"));
fclose($fp);
echo "替换前:\n".$str;
$str=preg_replace(‘/^\s*$/m‘, ‘‘, $str);
$str=preg_replace(‘/\n{2}/‘, "\n", $str);
echo "替换后:\n".$str;
?>
标签:
原文地址:http://my.oschina.net/u/855028/blog/493405