función de PHP ftp_cdup ()
Definición y Uso
ftp_cdup función () para cambiar el directorio actual al directorio padre en el servidor FTP.
Si tiene éxito, la función devuelve TRUE. Si se produce un error, devuelve FALSO.
gramática
ftp_cdup(ftp_connection)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
Ejemplos
<?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);
?>
$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);
?>
El código anterior es la salida:
Dir: /
Dir: /images
Dir: /
Dir: /images
Dir: /
Completar PHP FTP Referencia