PHP ftp close

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : ftp_close() function

Description

The ftp_close() function is used to close an FTP connection.

Version

(PHP 4 and above)

Syntax

ftp_close(ftp_connection) 

Parameters

Name

Description

Required /
Optional

Type

ftp_connection

The link identifier of the FTP connection.

Required

Resource

 

Return value

TRUE on success or FALSE on failure.

Value Type : Boolean.

Example :

  1. $ftp_server="192.168.0.2";  

  2. $ftp_user_name="abc123";  

  3. $ftp_user_pass="abc123";  

  4. // set up basic connection  

  5. $conn_id = ftp_connect($ftp_server);  

  6. // login with username and password  

  7. $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);  

  8. // print the current directory  

  9. echo ftp_pwd($conn_id); // /  

  10. // close this connection  

  11. ftp_close($conn_id);  

  12. ?>