若成功,则返回 true,否则返回 false,如果切换目录失败,php还会发出一条警告.
语法:ftp_chdir(ftp_connection,directory)
参数 描述
ftp_connection 必需,规定要使用的 ftp 连接,ftp 连接的标识符.
directory 必需,规定要切换到的目录.
- */
-
- $conn_id=ftp_connect($ftp_server);
-
- $login_result=ftp_login($conn_id,$ftp_user_name,$ftp_user_pass);
-
- if((!$conn_id)||(!$login_result))
- {
- die("ftp connection has failed !");
- }
- echo "current directory:", ftp_pwd($conn_id),"n";
-
- if(@ftp_chdir($conn_id,"somedir"))
- {
- echo "current directory is now:", ftp_pwd($conn_id),"n";
- }
- else
- {
- echo "couldn't change directoryn";
- }
-
-
- ftp_cdup($dir);
-
-
-
-
-
-
|