w3resource

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:

<?php
$ftp_server="192.168.0.2";
$ftp_user_name="abc123";
$ftp_user_pass="abc123";
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// print the current directory
echo ftp_pwd($conn_id); // /
// close this connection
ftp_close($conn_id);
?>

See also

PHP Function Reference

Previous: ftp_chmod
Next: ftp_connect



Follow us on Facebook and Twitter for latest update.