php Laravel 5 - 查看 [主页] 未找到

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28578012/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 23:57:08  来源:igfitidea点击:

Laravel 5 - View [home] not found

phplaravel-4laravel-5

提问by Mike Barwick

I ran composer updateand now I'm running into an issue. I'm getting this error when I'm trying to load my home view:

我跑了composer update,现在我遇到了一个问题。当我尝试加载主视图时出现此错误:

InvalidArgumentException in FileViewFinder.php line 140:
View [home] not found.

Yes, files exists in my directory (resources/views, etc.). Name is home.blade.php.

是的,文件存在于我的目录中(资源/视图等)。名字是home.blade.php

My controller:

我的控制器:

<?php namespace Hulahoop\Http\Controllers;

use Hulahoop\Http\Requests;
use Hulahoop\Http\Controllers\Controller;

use Illuminate\Http\Request;

class HomeController extends Controller {

    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
        return view('home');
    }

}

Route:

路线:

Route::get('/', 'HomeController@index');

This was working fine and it's very basic function. What happened? Running on local homestead FYI.

这工作正常,它是非常基本的功能。发生了什么?在当地宅基地上运行仅供参考。

UPDATE:When I run php artisan serve, I can view the home page view fine (i.e. on http://localhost:8000). But on homestead, no dice. What gives?

更新:当我运行时php artisan serve,我可以很好地查看主页视图(即在http://localhost:8000 上)。但在宅基地,没有骰子。是什么赋予了?

回答by Sebastian Sulinski

There seem to be a problem with vagrant and php artisan config:cache. If you run php artisan config:clearand then try to open the page - you should see it working fine - just make sure you don't cache it via artisan.

vagrant 和php artisan config:cache. 如果您运行php artisan config:clear然后尝试打开该页面 - 您应该会看到它工作正常 - 只要确保您没有通过 artisan 缓存它。

回答by Ihab Shoully

Check out [ vendor/config.php] it's hard-coded for local development.

查看 [ vendor/config.php] 它是针对本地开发进行硬编码的。