Phar
PHP Manual

Phar::delete

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

Phar::deleteDelete a file within a phar archive

Description

int Phar::delete ( string $entry )

Note: Cette méthode nécessite que la variable de configuration INI phar.readonly soit définie à 0 pour fonctionner avec les objets Phar. Sinon, une exception PharException sera lançée.

Delete a file within an archive. This is the functional equivalent of calling unlink() on the stream wrapper equivalent, as shown in the example below.

Liste de paramètres

entry

Path within an archive to the file to delete.

Valeurs de retour

returns TRUE on success, but it is better to check for thrown exception, and assume success if none is thrown.

Erreurs / Exceptions

Throws PharException if errors occur while flushing changes to disk.

Exemples

Exemple #1 A Phar::delete() example

<?php
try {
    
$phar = new Phar('myphar.phar');
    
$phar->delete('unlink/me.php');
    
// this is equivalent to:
    
unlink('phar://myphar.phar/unlink/me.php');
} catch (
Exception $e) {
    
// handle errors
}
?>

Voir aussi


Phar
PHP Manual