Table of Contents

unlink

WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0

Remove a file (delete it)

Description

int unlink ( string $filename )

This function deletes a file. It is similar to the Unix C unlink() function.

Parameter

$filename: Using a / at the beginning will make it relative to the root, otherwise it will be relative to the current working directory, which is either the folder that the script was started in or as was set by chdir().

Return Values

Integer: 0=success, otherwise error code

Example

<?
  $fh=fopen('unlink_example.html','a');
  fwrite($fh,'Hello world!');
  fclose($fh);
 
  $res=unlink('unlink_example.html');
  print("Unlinking the file returned: ".$res);
?>

See Also

rmdir() - Remove a directory, with optional deletion of contents