为什么重命名功能不起作用?
$new_image_name = $maximum_id + 1 . '.jpg';
$old_image_name = $file_name;
// Rename the image file
rename($profile_folder . $old_image_name, $profile_folder . $new_image_name);
var_dump($profile_folder . $old_image_name, $profile_folder . $new_image_name);
给了我
string(56) "/var/www/myproject/public/images/1/profile/old.jpg" string(50) "/var/www/myproject/public/images/1/profile/1.jpg"
var_dump(rename($profile_folder . $old_image_name, $profile_folder . $new_image_name));
返回(bool)false
路径正确,但文件未重命名并使用旧名称上传。我做错了什么?