ftp_delete

(PHP 4, PHP 5, PHP 7, PHP 8)

ftp_delete刪除 FTP 服務(wù)器上的一個(gè)文件

說明

ftp_delete(resource $ftp_stream, string $path): bool

ftp_delete() 函數(shù)用來刪除 FTP 服務(wù)器上的一個(gè)由參數(shù) path 指定的的文件。

參數(shù)

ftp_stream

FTP 連接的鏈接標(biāo)識(shí)符。

path

要?jiǎng)h除的文件。

返回值

成功時(shí)返回 true, 或者在失敗時(shí)返回 false

范例

示例 #1 ftp_delete() 例子

<?php
$file 
'public_html/old.txt';

// set up basic connection
$conn_id ftp_connect($ftp_server);

// login with username and password
$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);

// try to delete $file
if (ftp_delete($conn_id$file)) {
 echo 
"$file deleted successful\n";
} else {
 echo 
"could not delete $file\n";
}

// close the connection
ftp_close($conn_id);
?>