PHP头条
热点:

逐行删除文件中的内容-PHP源码


php代码

function delline($file)
{
	$fp = fopen($file,"r");
	$tmp = tempnam("./","temp0");
	$tmp_fp = fopen($tmp,"w");
	$i=0;
	while(!feof($fp)){
		$line = fgets($fp);
		if($i!=0){
			fputs($tmp_fp,$line);
		}
		$i++;
	}
	fclose($fp);
	fclose($tmp_fp);
	rename($tmp,$file);
}

www.phpzy.comtrue/php/35963.htmlTechArticle逐行删除文件中的内容-PHP源码 php代码 function delline($file){$fp = fopen($file,"r");$tmp = tempnam("./","temp0");$tmp_fp = fopen($tmp,"w");$i=0;while(!feof($fp)){$line = fgets($fp);if($i!=0){fputs($tmp_fp,$line);}$i++;}fclose(...

相关文章

PHP之友评论

今天推荐