(PHP 4, PHP 5, PHP 7)
ftp_rename — 锟斤拷锟斤拷 FTP 锟斤拷锟斤拷锟斤拷锟较碉拷锟侥硷拷锟斤拷目录锟斤拷
$ftp_stream
, string $oldname
, string $newname
) : boolftp_rename() 锟斤拷 FTP 锟斤拷锟斤拷锟斤拷锟较碉拷一锟斤拷锟侥硷拷锟斤拷目录锟斤拷锟斤拷锟斤拷
ftp_stream
FTP 锟斤拷锟接的憋拷识锟斤拷锟斤拷
oldname
原锟斤拷锟斤拷锟侥硷拷锟斤拷目录锟斤拷锟斤拷
newname
锟斤拷锟斤拷锟街★拷
锟缴癸拷时锟斤拷锟斤拷 TRUE
锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE
锟斤拷
Example #1 ftp_rename() 锟斤拷锟斤拷
<?php
$old_file = 'somefile.txt.bak';
$new_file = 'somefile.txt';
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// try to rename $old_file to $new_file
if (ftp_rename($conn_id, $old_file, $new_file)) {
echo "successfully renamed $old_file to $new_file\n";
} else {
echo "There was a problem while renaming $old_file to $new_file\n";
}
// close the connection
ftp_close($conn_id);
?>