一个大量的替换文件中相配的字符并将文件存盘
<? 
/* 文件名: massreplace.inc 
* 用法: massreplace(STRING1, STRING2, FILE); 
* Description: Similar to the Unix 'massreplace' command, this 
* function takes the value of "STRING2" and replaces 
* every instance of "STRING1" with STRING2's value in 
* "FILE". 
*/ 

/* $Id: massreplace.inc,v 1.0 1998/07/21 23:04:12 darrell Exp $ */ 

Function massreplace($string1$string2$filename) { 
$fd fopen$filename"r" ); 
$contents fread$fdfilesize$filename ) ); 
$size filesize$filename ); 
fclose$fd ); 
$massreplace ereg_replace($string1$string2$contents); 
$fd fopen($filename"w"); 
fputs($fd$massreplace$size); 
fclose($fd); 

?>