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: Fri, 20 Jun 2008

view this page in

delete

(No version information available, might be only in CVS)

delete — Voir unlink() ou unset()

Description

void delete ( void )

Ceci est une page d'entrée du manuel pour ceux qui recherchent la fonction unlink() ou unset().

Valeurs de retour

Aucune valeur n'est retournée.

Voir aussi



add a note add a note User Contributed Notes
delete
Guilherme Komel
29-Dec-2007 04: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
30-Sep-2006 01: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: Fri, 20 Jun 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites