我想呈现一个简单的视图:

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)

I clear config cache...

$ php artisan config:clear
Configuration cache cleared!

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

Why does it only work without cache config ?

推荐答案

当你的机器在vagrant(或其他虚拟环境)上运行,而你的vagrant用完了php artisan config:cache次时,它就不工作了.你需要在vagrant中运行这个命令吗.问题在于路径路径(在流浪者和离开流浪者的路径不同).

Laravel相关问答推荐

Laravel带S3存储器

Laravel中的策略对我不起作用,这是我的代码

vagrant会损坏你的电脑. | macOS v12(蒙特雷)#13132

如何在自定义表单请求中获取错误验证数据

安卓 retrofit |发布自定义对象(将 json 发送到服务器)

Laravel PHP 框架的新手. /以外的路由不起作用

如何在 laravel 5.2 中显示 500 内部服务器错误页面?

Laravel 4 定义 RESTful 控制器

Laravel whereDoesntHave() - 多个 OR 条件

需要 Vagrant 环境或目标机器

Laravel 5 文件下载:stream() 或 download()

php Laravel-遇到格式不正确的数值(在字符串上)

Cookie::forget 不工作 laravel 5.1

Laravel 动作未定义

如何在本地 Laravel Homestead 站点上获取 https 证书

Laravel 5 环境配置数组?

判断输入是否来自控制台

Laravel 5.2 验证错误未出现在Blade中

如何判断是否连接到 Laravel 4 中的数据库?

以编程方式而不是从 CLI 运行 Laravel 5 seeder