PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

dirname> <copy
Last updated: Mon, 26 Nov 2007

view this page in

delete

(PECL zip:1.1.0-1.4.1)

delete — 参见 unlink()unset()

说明

void delete ( string $file )

这是个虚构的手册条目来给那些本来是找 unlink() 或者 unset() 的人提供一些有用的信息。

参见 unlink() 来删除文件,unset() 来删除变量。



dirname> <copy
Last updated: Mon, 26 Nov 2007
 
add a note add a note User Contributed Notes
delete
Anonymous
30-Jun-2008 09:17
don't forget that this dummy should also point to the rmdir function
Guilherme Komel
30-Dec-2007 08:14
I have founda that trying to delete a file using relative path like the example below does not work.

    $do = unlink("../pics/$fileToDel");
    if($do=="1"){
        echo "The file was deleted successfully.";
    } else { echo "There was an error trying to delete the file."; }

I did not work at all, instead what I had to do was:

    chdir('../pics/');
    $do = unlink($fileToDel);
    if($do=="1"){
        echo "The file was deleted successfully.";
    } else { echo "There was an error trying to delete the file."; }

Then it worked !
bmcouto at hotmail dot com
01-Oct-2006 04:30
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fclose($fh);

Now to delete testFile.txt we simply run a PHP script that is located in the same directory. Unlink just needs to know the name of the file to start working its destructive magic.

$myFile = "testFile.txt";
unlink($myFile);

The testFile.txt should now be removed.

dirname> <copy
Last updated: Mon, 26 Nov 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites