php unlink() function


  Translation results:

UK[ˌʌn'lɪŋk] US[ˌʌn'lɪŋk]

vt.Unlock the link of...

Third person singular: unlinks Present participle: unlinking Past tense: unlinked Past participle: unlinked

php unlink() functionsyntax

Function:Delete files.

Syntax: unlink(filename,context)

Parameters:

ParametersDescription
filename Required. Specifies the files to be deleted.
contextOptional. Specifies the environment for a file handle. Context is a set of options that modify the behavior of the stream.

Description: If successful, it will return true, if it fails, it will return false.

php unlink() functionexample

<?php
$file = "./test.txt";
if (!unlink($file))
{
    echo ($file."删除失败");
}
else
{
    echo ($file."删除成功");
}
?>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A