Php Laravel File::get()文件在路径异常处不存在

Php Laravel File::get()文件在路径异常处不存在,php,laravel,file-get-contents,Php,Laravel,File Get Contents,我正在尝试使用Laravel文件系统获取外部文件,但我不断获取路径中不存在文件的异常 这是我的密码 File::get('http://lorempixel.com/272/172'); 正在调用的Laravel函数 public function get($path, $lock = false) { if ($this->isFile($path)) { return $lock ? $this->sharedGet($path) : file_get

我正在尝试使用Laravel文件系统获取外部文件,但我不断获取路径中不存在
文件的异常

这是我的密码

File::get('http://lorempixel.com/272/172');
正在调用的Laravel函数

 public function get($path, $lock = false)
{
    if ($this->isFile($path)) {
        return $lock ? $this->sharedGet($path) : file_get_contents($path);
    }

    throw new FileNotFoundException("File does not exist at path {$path}");
}
我已经测试了
文件获取内容('http://lorempixel.com/272/172)
在我的服务器上运行,效果很好

在我得到的if语句中,如果do
dd($path)
,这是非常奇怪的

“/home/vagrant/code/test/storage/framework/sessions/fdb554540ba30a38464950b36908fa20e0ee94cc”
返回

如果我在If语句之外执行了
dd($path)
,我会得到
http://lorempixel.com/272/172
返回


我很困惑

文件::get
仅适用于本地文件,在4.1之前的laravel版本中,您可以使用
文件::getRemote

$content = File::getRemote("http://lorempixel.com/272/172");

但它在laravel 4.1中被删除。据拉威尔的创造者@taylorotwell说,这是不安全的。它所做的只是调用
file\u get\u contents
,所以只要将它替换为
file\u get\u contents
,您就应该很好了。

file::getRemote在5.1中已被弃用