คำอธิบาย
ฟังก์ชัน ftp_delete() ใช้ลบไฟล์บนเซิร์ฟเวอร์ FTP
รูปแบบการใช้งาน (Syntax)
ftp_delete($con, $myfile);
พารามิเตอร์
con − การเชื่อมต่อ FTP
myfile − ไฟล์ที่จะลบ
ค่าที่คืนกลับ
ฟังก์ชัน ftp_delete() คืนค่า TRUE เมื่อสำเร็จ หรือ FALSE เมื่อล้มเหลว
ตัวอย่าง
<?php
$ftp_server = "192.168.0.4";
$ftp_user = "amit";
$ftp_pass = "tywg61gh";
$con = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$myfile = "E:/new/demo.txt";
if (ftp_delete($con, $myfile)) {
echo "The file deleted!";
} else {
echo "The file cannot be deleted!";
}
ftp_close($con);
?>