windows下tp6 php7.4下上传图片报错

浏览:925 发布日期:2020/04/09
5.0.0 - 致命 - 未处理
fopen() expects parameter 1 to be a valid path, bool given


public function putFileAs(string $path, File $file, string $name, array $options = [])
{
$stream = fopen($file->getRealPath(), 'r'); //这行报错
}
替换成 $stream = fopen($file->getPathName(), 'r'); 即可
$file->getPathName() 在linux和windows都存在
评论()
后面还有条评论,点击查看>>