PHP ftp_pwd() 函數

定義和用法
ftp_pwd() 函數返回指定 FTP 連接的當前目錄名稱。
語法
ftp_pwd(ftp_connection)
參數 | 描述 |
---|---|
ftp_connection | 必需。規定要使用的 FTP 連接。 |
實例
<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
// print current directory
echo ftp_pwd($conn) . "<br />";
// change directory to images
ftp_chdir($conn,"images");
// print current directory
echo ftp_pwd($conn);
ftp_close($conn);
?>
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
// print current directory
echo ftp_pwd($conn) . "<br />";
// change directory to images
ftp_chdir($conn,"images");
// print current directory
echo ftp_pwd($conn);
ftp_close($conn);
?>
上面的代碼將輸出:
/
/images
/images
