ftp_quit() function in PHP


The ftp_quit() function is an alias to ftp_close(). It closes an FTP connection.

Syntax

ftp_quit(con);

Parameters

  • con − The connection to close.

Return

The ftp_quit() 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 the 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_quit($con); ?>

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 30-Jul-2019

39 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements