Home > Backend Development > PHP Problem > How to delete server files in php

How to delete server files in php

藏色散人
Release: 2023-03-04 21:58:01
Original
3485 people have browsed it

You can use the "ftp_delete" function to delete server files in PHP. The syntax is "ftp_delete(ftp_connection,file)". The parameter "ftp_connection" indicates the FTP connection to be used, and the parameter "file" indicates the file to be deleted. The path to the file.

How to delete server files in php

Recommended: "PHP Video Tutorial"

PHP ftp_delete() function

Definition and usage

ftp_delete() function deletes a file on the FTP server.

If successful, this function returns TRUE. On failure, returns FALSE and a warning.

Syntax

ftp_delete(ftp_connection,file)
Copy after login

Parameters

ftp_connection Required. Specifies the FTP connection to use.

file Required. Specifies the path of the file to be deleted.

Example

<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
echo ftp_delete($conn,"test.txt");
ftp_close($conn);
?>
Copy after login

The above code will output:

1

The above is the detailed content of How to delete server files in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template