Manuel Pear

Net_FTP::rm()

Net_FTP::rm() -- deletes a file or directory.

Synopsis

  1. <?php
  2. require_once 'Net/FTP.php
  3. ?> 

mixed Net_FTP::rm ([string $path = null [, string $recursive = false]])

Description

This method deletes a file or a directory.

Paramètres

  • string $path = null - The file or directory to delete. In case you set the second parameter to true, directories will be deleted even if not empty. All files and directories inside will be deleted.

  • $recursive = false - This parameter determines, whether a directory is deleted only if it's empty (standard) or if all included files and directories will be deleted with it ($recursive = true).

Valeur retournée

mixed - true on success, otherwise PEAR::Error.

Valeurs renvoyées

Several errors may be returned by rm. The errornumber is unspecific (until now) and will not tell you anything about the errormessage. Possible errors are:

Tableau 54-1. Valeurs PEAR_Error possibles

Error message Description Solution
Could not delete file '$file'. The file named $file (complete path) could not be deleted. Either the file does not exist or you do not have the permission to delete it. So check if the file exists and you have permissions on it.
Directory name '$dir' is invalid, has to end with '/' You entered a directory for deletion ($recursive = true) without ending '/'. Correct your parameter.
Could not delete directory '$dir'. The directory $dir could not be deleted. Maybe the directory is not empty ($recursive = false) or you do not have the permission to delete the directory.

Note

Cette fonction ne peut pas être appelée de façon statique.

Exemple

Exemple 54-1. Using rm()

  1. <?php
  2.    
  3.    var_dump($test->rm('/foo/bar/', true)); 
  4.    
  5.  
  6. ?> 

Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Bretagne - php - Moto - Kit graphique