tp5的File操作类有错误

浏览:4843 发布日期:2016/05/13 分类:ThinkPHP5专区
public function move($path, $savename = '', $replace = true)
{
if (!is_uploaded_file($this->getRealPath())) {
$this->error = '不是文件';
return false;
}

if (false === $this->checkPath($path)) {
$this->error = '路径错误';
return false;
}

$savename = $savename ?: $this->getFilename();
/* 不覆盖同名文件 */
if (!$replace && is_file($path . $savename)) {
$this->error = '存在同名文件' . $path . $savename;
return false;
}

/* 移动文件 */
if (!move_uploaded_file($this->getRealPath(), $path . $savename)) {
$this->error = '文件上传保存错误!';
return false;
}
//这里漏写了 \
return new \SplFileInfo($path . $savename);
}
最佳答案
评论( 相关
后面还有条评论,点击查看>>