Definition and Usage
ftp_cdup () function to change the current directory to the parent directory on the FTP server.
If successful, the function returns TRUE. If it fails, FALSE is returned.
grammar
ftp_cdup(ftp_connection)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
Examples
<?php $conn = ftp_connect("ftp.testftp.com") or die("Could not connect"); ftp_login($conn,"admin","ert456"); //Outputs the current directory echo "Dir: ".ftp_pwd($conn); echo "<br />"; //Change to the images directory ftp_chdir($conn,"images"); echo "Dir: ".ftp_pwd($conn); echo "<br />"; //Change current directory to parent directory ftp_cdup($conn); echo "Dir: ".ftp_pwd($conn); ftp_close($ftp_server); ?>
The above will output:
Dir: / Dir: /images Dir: /