PHP FTP operation

WBOY
Release: 2016-07-29 09:13:53
Original
1267 people have browsed it

* FTP server
* //Connect to FTP server
* $conn = ftp_content(ftp.server.com);
* //Use username, password to log in
* ftp_login($conn,$username,$password);
* / /Get the remote system type
* ftp_systype($conn);
* //Get the current system directory
* ftp_pwd($conn);
* //List files
* $file_list = ftp_nlist($conn,". ");
* //Download file
* ftp_get($conn,"data.zip","data.zip",FTP_BINARY);
* //Close the connection
* ftp_quit($conn);
* //Passive Mode PASV
* ftp_pasv($conn,1);
* //Enter the directory, it accepts a directory name parameter
* ftp_chdir($conn, directory name);
* //Go back to the parent directory
* ftp_cdup ($conn);
* //Create a new directory, or move a directory
* ftp_mkdir($conn,"test"); If the creation is successful, the new directory name will be returned
* ftp_rmdir($conn,"test" );
* //Upload files
* ftp_put($conn,$src,$des,FTP_ASCII);
* $src: Uploaded file name
* $des: Uploaded file name
* FTP_ASCII: Upload form
* //Download file
* ftp_get($conn,$src,$des,FTP_ASCII);
* $src: Downloaded file name
* $des: Downloaded file name
* FTP_ASCII: Transmitted Form
*
* //Two ways to display a directory list:
* ftp_nlist(); only display the file name of the directory
* ftp_rawlist(); display the file name, permissions, creation time, and created role in the directory
* // Return the size of the file
* ftp_size(); Return the size of a file in BYTE, if -1 is returned, it is the directory
*
*
*
*/

The above has introduced the PHP FTP operation, including uploading files. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template