[英]PHP rename() does not find file with space in filename
我正在使用PHP named()函數移動文件。 但是文件名中有空格。 由於某種原因,它找不到它。 我嘗試將其轉義,但這也不起作用。 有人知道發生了什么嗎? 它在Unix系統上。
$filename = basename($file->uri);
// Tried this once didn't work either:
$filename = str_replace(' ', "\ ", $filename);
//
rename($_SERVER['DOCUMENT_ROOT'].$source.'/'.$filename,
drupal_realpath($file->uri));
提前非常感謝您。
我不認為這是空間問題。 您提供的重命名功能路徑中可能不存在您的文件,可能很簡單。
嘗試顯示路徑:
echo $_SERVER['DOCUMENT_ROOT'].$source.'/'.$filename;
並確保此路徑在您的情況下確實有效
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.