laravel 5中的配置缓存未在视图中找到 [英] Config cache in laravel 5 results in view not found

查看:125
本文介绍了laravel 5中的配置缓存未在视图中找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想渲染一个简单的视图:

I'm tying to render a simple view:

public function test()
{
    return \View::make('test');
}

我缓存了我的配置:

$ php artisan config:cache
Configuration cache cleared!
Configuration cached successfully!

当我在网络浏览器中运行它时:

When I run it in a web browser I've got :

InvalidArgumentException in FileViewFinder.php line 140:
View [test] not found.
in FileViewFinder.php line 140
at FileViewFinder->findInPaths('test', array('/XXXXXX/resources/views')) in FileViewFinder.php line 77
at FileViewFinder->find('test') in Factory.php line 145
at Factory->make('test') in Facade.php line 213
... (framework backtrace)

我清除了配置缓存...

I clear config cache...

$ php artisan config:clear
Configuration cache cleared!

...呈现视图(这是一个简单的HTML视图resources/views/test.blade.php)

...View is rendered (it's a simple HTML view resources/views/test.blade.php)

为什么只有在没有缓存配置的情况下它才能工作?

Why does it only work without cache config ?

推荐答案

当您的计算机在无业游民(或其他虚拟环境)上运行并且您在无业游民中运行php artisan config:cache时,它不起作用.您是否需要在无业游民中运行此命令.问题在于路径路由(无业游民的路径与无业游民的路径不同).

It does not work when your machine is running on vagrant (or another virtual environnement) and you run php artisan config:cache out of vagrant. Do you need to run this command in vagrant. The problem is about path routes (path are not the same in vagrant and out of vagrant).

这篇关于laravel 5中的配置缓存未在视图中找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆