![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
ftp_close() function in PHP
The ftp_close() function closes an FTP connection.
Syntax
ftp_close(con);
Parameters
con − The connection to close.
Return
The ftp_close() function returns TRUE on success or FALSE on failure
Example
The following is an example that login to a connection, works in it to change the directory and then connection is closed −
<?php $ftp_server="ftp.example.com"; $ftp_user="kevin"; $ftp_pass="tywg61gh"; $con = ftp_connect($ftp_server); $res = ftp_login($con, $ftp_user, $ftp_pass); ftp_chdir($con, 'demo'); echo ftp_pwd($con); if (ftp_cdup($con)) { echo "Directory changed!
"; } else { echo "Directory change not successful!
"; } echo ftp_pwd($con); ftp_close($con); ?>
Advertisements