1

我有以下功能:

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): 是一个目录”

该文件已成功复制到第二个目录,但没有从第一个目录中删除。rename() 返回 false 并给出此警告。我认为这可能是具有权限的东西,但是在尝试了一堆东西之后,我似乎无法弄清楚。

任何帮助,将不胜感激。

4

1 回答 1

2

您的代码正在使用$newpath

if (!$this->_createFolder($newPath))
        return false;

然后$newpath变成一个目录。

于 2013-07-12T01:51:03.977 回答