【发布时间】:2022-01-17 09:37:33
【问题描述】:
我想使用 PHP rename() 函数将文件从 one directory 移动到 another directory。但该功能不起作用。每次显示Not done。请提出您的建议。
这是我的代码
<?php
error_reporting(1);
error_reporting('On');
include 'includes/config.php'; // database configuration file
$site_path = "http://www.website.com/";
$file_name = "images800466507.jpg";
$currentPath = 'TempImages/'.$file_name; // ( file permission : 777 )
$newPath = 'ImagesNew/'.$file_name; // ( file permission : 755 )
if( rename($site_path.$currentPath , $site_path.$newPath ) )
echo 'done';
else
echo 'not done';
?>
【问题讨论】:
-
你应该使用本地路径。
-
本地路径意味着..???您是在谈论绝对路径..?? '/var/www/website.com/public_html/'
-
本地路径表示您的项目文件夹路径。不是在线网站名称
-
不是
http://www.website.com,而是更像/var/www/temp_images/或本地路径的任何地方 -
'/var/www/website.com/public_html/' ......????