ftp_delete

(PHP 3 >= 3.0.13, PHP 4, PHP 5)

ftp_delete -- 删除 FTP 服务器上的一个文件

描述

bool ftp_delete ( resource ftp_stream, string path )

ftp_delete() 函数用来删除 FTP 服务器上的一个由参数 path 指定的的文件。

如果成功则返回 TRUE,失败则返回 FALSE


add a note add a note User Contributed Notes
webmaster at iamsowonderful dot com
04-Apr-2005 01:37
You can make a script delete itself with ftp_delete!

It's pretty useful when creating an install script which you want to destroy at the end of the installation to prevent it from being run later.

On Linux machines, very often the user uploads third party scripts, and gets asked to CHMOD this and delete that manually because the webserver user is different from the FTP user ; make them enter their FTP info and get rid of the tedious file manipulation step!

Be careful, though. You will need to flush the output buffer and call ftp_delete at the end of the script, or else the script will die before it fully executes. Look up ob_end_flush for more info.