php - laravel 5 中的配置缓存导致找不到 View

标签 php laravel laravel-5

我想渲染一个简单的 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/

相关文章:

laravel - google-api 如何在带有 token 的离线请求中工作

php - 当尝试在 Laravel 5 上上传开发中的文件时,我得到 stream_socket_sendto() : error

php - 带引号的 SQL 查询不返回结果

php - Lumen 中 URL 没有参数时重定向

php - 带有动态消息的 Laravel 自定义验证规则

php - Laravel Eloquent 如何加入查询而不是表?

php - "Expected response code 250 but got code "554 ", with message "554 5.2.0 STOR EDRV“

php - 如何在cakephp中验证关联模型

php - 使所有变量成为全局变量,PHP

php - 从字符串参数获取变量 MySQL PHP