[PHP]24.File刪除檔案-unlink

  • 2122
  • 0
  • php
  • 2022-12-03

文、意如

刪除檔案
<?php
  $filename = "mytest.txt";
  #echo file_exists($filename); #判斷檔案是否存在,存在回傳1
  if(file_exists($filename)){ #當檔案存在時(1=true)
	unlink($filename);  #刪除檔案
	echo "刪除檔案成功!";
  }else{
	echo "檔案不存在,刪除檔案失敗!";
  }
?>

 

 

 

 

 

 

 

 

 

 

參考

Yiru@Studio - 關於我 - 意如