función de PHP ftp_chdir ()
Definición y Uso
ftp_chdir función () para cambiar el directorio actual al directorio especificado en el servidor FTP.
Si tiene éxito, la función devuelve TRUE. Si no lo consigue, FALSE y se devuelve un aviso.
gramática
ftp_chdir(ftp_connection,directory)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
directory | 必需。规定要切换到的目录。 |
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);
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);
ftp_close($ftp_server);
?>
El código anterior es la salida:
Dir: /
Dir: /images
Dir: /images
Completar PHP FTP Referencia