PHP Development notes series (6)-Built-in FTP functions

Source: Internet
Author: User
PHP Development notes series (6)-Built-in FTP functions ??? FTP is a type of server that we often use. it can be used to receive files sent from a third-party system. as a receiving point, our system then regularly accesses FTP to obtain files for internal business processing, is a very convenient intermediate medium .???? Following the PHP development Notes Series (5)-I PHP Development notes series (6)-Built-in FTP functions

??? FTP is a type of server that we often use. it can be used to receive files sent from a third-party system. as a receiving point, our system then regularly accesses FTP to obtain files for internal business processing, it is a convenient intermediate medium.


???? Following the "PHP development Notes Series (V)-INI file explanation", this article "PHP Development notes series (6) -Built-in FTP functions: describes how to use the built-in FTP functions of PHP to perform common FTP browsing, uploading, and downloading operations.

?

???? 1. Use the built-in FTP function of PHP to operate ftp

??? PHP has built-in FTP functions. you can use FTP functions for connect, login, chdir, list, and other operations. below we will experiment with FTP functions through code.

?

file:ftp-access.phpurl:http://localhost:88/ftp/ftp-access.php
 ';        $files = ftp_nlist($ftp, $targetDir);    foreach ($files as $file){        echo $file.'
'; } ftp_quit($ftp); ?>
?

??? The above demonstrates how to use the built-in functions of php to connect to the ftp server, log on to the server, switch the directory, and display the contents in the directory.


??? In addition to accessing the ftp server, files are often downloaded and uploaded. the code is as follows:


??? Download file:

file:ftp-get.phpurl:http://localhost:88/ftp/ftp-get.php
 

?

??? Upload files:

?

file:ftp-put.phpurl:http://localhost:88/ftp/ftp-put.php
 
?

?

??? Address: http://ryan-d.iteye.com/admin/blogs//1543414

?

?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.