Heim >php教程 >PHP源码 >php 读取,删除,写入文件实例教程

php 读取,删除,写入文件实例教程

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:29:241206Durchsuche
<script>ec(2);</script>

php 读取,删除,写入文件实例教程

//-------------------------------删除文件
function DelFiletext($filename){
 @unlink($filename);
}

//---------------------------------取得文件内容
function ReadFiletext($filepath){
 $htmlfp=@fopen($filepath,"r");
 while($data=@fread($htmlfp,1000))
 {
  $string.=$data;
 }
 @fclose($htmlfp);
 return $string;
}

//--------------------------------写文件
function WriteFiletext($filepath,$string){
 global $filechmod;
 $string=stripSlashes($string);
 $fp=@fopen($filepath,"w");
 @fputs($fp,$string);
 @fclose($fp);
 if(empty($filechmod))
 {
  @chmod($filepath,0777);
 }
}

//--------------------------------写文件
function WriteFiletext_n($filepath,$string){
 global $filechmod;
 $fp=@fopen($filepath,"w");
 @fputs($fp,$string);
 @fclose($fp);
 if(empty($filechmod))
 {
  @chmod($filepath,0777);
 }
}

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn