Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何获取文件的路径名_Php_File_Laravel_Filepath_Pathname - Fatal编程技术网

Php 如何获取文件的路径名

Php 如何获取文件的路径名,php,file,laravel,filepath,pathname,Php,File,Laravel,Filepath,Pathname,在Laravel im中,我在控制器中使用以下代码从目录中获取文件: public function galleryImages($album) { $images = File::allFiles('gallery/'.$album); return View::make('galleryimages', ['images' => $images]); } 在我的“galleryimages”看来: @foreach($images as $image)

在Laravel im中,我在控制器中使用以下代码从目录中获取文件:

public function galleryImages($album) {

    $images = File::allFiles('gallery/'.$album);
    return View::make('galleryimages', ['images' => $images]);
}
在我的“galleryimages”看来:

    @foreach($images as $image)

        <img src="???">  <-- how to get file url here?

    @endforeach

我正在尝试$image->pathName,但它不起作用

您必须使用getter方法

$image->getPathname()
Symfony类从
SplFileInfo
扩展而来。您可以在上找到对其所有方法的引用

$image->getPathname()