PHP의 ftp_chdir () 함수
정의 및 사용
ftp_chdir () 함수는 FTP 서버의 현재 디렉토리를 지정된 디렉토리로 변경합니다.
성공하면, 함수는 TRUE를 반환합니다. 그것은, FALSE 실패하면 경고가 리턴됩니다.
문법
ftp_chdir(ftp_connection,directory)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
directory | 必需。规定要切换到的目录。 |
예
<?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);
?>
가 출력 위의 코드 :
Dir: /
Dir: /images
Dir: /images
PHP FTP 참조 완료