我想渲染一个简单的 View :
public function test()
{
return \View::make('test');
}
我缓存我的配置:
$ php artisan config:cache
Configuration cache cleared!
Configuration cached successfully!
当我在网络浏览器中运行它时,我得到了:
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)
我清除配置缓存...
$ php artisan config:clear
Configuration cache cleared!
... View 已呈现(这是一个简单的 HTML View resources/views/test.blade.php
)
为什么它只能在没有缓存配置的情况下工作?
最佳答案
当您的机器在 vagrant(或其他虚拟环境)上运行并且您从 vagrant 运行 php artisan config:cache
时,它不起作用。你需要在 vagrant.xml 中运行这个命令吗?问题是关于路径路由(流浪者和流浪者外的路径不一样)。
关于php - laravel 5 中的配置缓存导致找不到 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28676605/