Current Location: Home> Function Categories> unlink

unlink

Delete files
Name:unlink
Category:File system
Programming Language:php
One-line Description:Delete the file.

Definition and usage

unlink() function deletes the file.

If successful, return true, and if failed, false.

实例

<?php
$file = "test.txt";
if (!unlink($file))
  {
  echo ("Error deleting $file");
  }
else
  {
  echo ("Deleted $file");
  }
?>

grammar

 unlink ( filename , context )
parameter describe
filename Required. Specify the files to be deleted.
context Optional. Specifies the environment for file handles. Context is a set of options that can modify the behavior of a stream.
Similar Functions
  • Write to files (safely used in binary files) fwrite

    fwrite

    Writetofiles(safelyu
  • Format the line to CSV and write to the file pointer fputcsv

    fputcsv

    FormatthelinetoCSVan
  • Get the last access time of the file fileatime

    fileatime

    Getthelastaccesstime
  • Open a file or URL fopen

    fopen

    OpenafileorURL
  • Get the inode modification time of the file filectime

    filectime

    Gettheinodemodificat
  • Delete directory rmdir

    rmdir

    Deletedirectory
  • Close process file pointer pclose

    pclose

    Closeprocessfilepoin
  • Read a line from a file pointer fgets

    fgets

    Readalinefromafilepo
Popular Articles