[英]PHP rename(<from>, <to>) gives warning: “Is a directory”
我有以下功能:
function move($currentPath, $newPath)
{
if (!$this->_createFolder($newPath))
return false;
if (!rename($currentPath, $newPath))
return false;
return true;
}
_createFolder()檢查目錄是否存在,如果不存在,則創建目錄。 我一直收到以下警告:
“重命名(/home/user/folder/folder/app/webroot/img/listings/incomplete/15/0/picture1.png,/home/user/folder/folder/app/webroot/img/listings/130/picture1 .png):是目錄“
該文件已成功復制到第二個目錄,但沒有從第一個目錄中刪除。 named()返回false並給出此警告。 我以為可能是有權限的東西,但是嘗試了一堆東西之后,我似乎無法弄清楚。
任何幫助,將不勝感激。
您的代碼正在使用$newpath
創建一個文件夾
if (!$this->_createFolder($newPath))
return false;
然后$newpath
成為目錄。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.