📜  在 php 代码示例中删除文件

📅  最后修改于: 2022-03-11 14:54:28.345000             🧑  作者: Mango

代码示例3
// delete file function, if silent is false, function will throw exception
function deleteFile($fullFileName, $silent=0) {
  if (file_exists($fullFileName)) {
    unlink($fullFileName);
    return TRUE;
  } else {
    if ($silent == 1) {
      return FALSE;
    } else {
      throw new \InvalidArgumentException('File "'.$fullFileName.'" not exists.');
    }
  }
}