PHP rename file on same host

前端 未结 3 1693
忘掉有多难
忘掉有多难 2021-01-26 15:00
$url = \'http://site.com/images/name.jpg\';

Its a full path for the file, which is already exists on ftp.

How can I change file\'s name

3条回答
  •  梦毁少年i
    2021-01-26 15:30

    if your script on the server root (http://site.com/script.php) that script will do:

    rename('images/oldname.jpg', 'images/newname.jpg');
    

    since that's the relative path of the image from the script point of view.

提交回复
热议问题