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
?
?