Php 访问Laravel 5中上载的文件属性

Php 访问Laravel 5中上载的文件属性,php,laravel,laravel-5,file-upload,Php,Laravel,Laravel 5,File Upload,我上传了一个文件 在我的控制器中,我这样做了 $file = Input::file('file'); dd($file); 我看到了 Illuminate\Http\UploadedFile {#1388 ▼ -test: false -originalName: "config-nsd-got.yaml" -mimeType: "application/x-yaml" -error: 0 #hashName: null pat

我上传了一个文件

在我的控制器中,我这样做了

$file = Input::file('file');
dd($file);
我看到了

Illuminate\Http\UploadedFile {#1388 ▼
  -test: false
  -originalName: "config-nsd-got.yaml"
  -mimeType: "application/x-yaml"
  -error: 0
  #hashName: null
  path: "/private/var/tmp"
  filename: "phpb73hcy"
  basename: "phpb73hcy"
  pathname: "/private/var/tmp/phpb73hcy" <<<<<<---------- I WANT TO ACCESS THIS
  extension: ""
  realPath: false
  writable: false
  readable: false
  executable: false
  file: false
  dir: false
  link: false
}
我只想要这个
/private/var/tmp/phpb73hcy


有什么提示吗?使用
$this->getPathname()


Laravel
UploadedFile
类扩展了Symfony类,它扩展了Symfony类,Symfony类扩展了PHP类。后者具有
getPathname()
方法。

来自Matt Stauffer的书Laravel Up and Running

每个上载的文件都是该类的后代,该类提供了一个
getRealPath()
方法,该方法返回文件位置的路径

->getRealPath()
也许?试试
$file->getPathname()
dd($file->pathname());
dd($file["pathname"]);
$path = $file->getRealPath();
dd($path);