PHP ftp_rename () function
Definition and Usage
ftp_rename () function to rename a file or directory on the FTP server.
If successful, the function returns TRUE. If it fails, it returns FALSE.
grammar
ftp_rename(ftp_connection,from,to)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
from | 必需。规定要重命名的文件或目录。 |
to | 必需。规定文件或目录的新名称。 |
Examples
<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
ftp_rename($conn,"oldname.txt","newname.txt");
ftp_close($conn);
?>
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
ftp_rename($conn,"oldname.txt","newname.txt");
ftp_close($conn);
?>
Complete PHP FTP Reference