【问题标题】:laravel - InvalidArgumentException view [pages.home] not foundlaravel - 找不到 InvalidArgumentException 视图 [pages.home]
【发布时间】:2016-07-07 15:57:28
【问题描述】:

我已经被这个难住了好几天了。当我尝试加载主页时出现此错误,标题中出现错误。我已经问过这个问题here 并尝试将 dd() 放在页面顶部,并运行 php artisan route:clear 以及其他命令,希望我可以加载主页。有趣的是我可以加载用户登录功能没有问题。

这是我的路线文件:

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('pages.home');
});



Route::auth();

视图结构:

【问题讨论】:

  • 向我们展示您的视图目录结构。你有文件名/resources/views/pages/home.blade.php吗?一个常见的问题是忘记文件名的 blade 部分或 php 扩展名。
  • 试试Route::get('/home', function () { return view('pages.home'); }); 告诉我结果
  • @xhulio 这就是他发布的代码。问题是它找不到视图。我怀疑这是文件命名或目录结构问题。
  • @JeremyHarris 几天前我遇到了同样的问题。它没有从/ 路线获得视图,但它与/home 一起使用
  • 这是我的目录结构截图https://postimg.org/image/7pv5qu23r/

标签: php laravel


【解决方案1】:

我发现了我的问题。我之前没有注意到这一点,但我在 PhpStorm 中的项目被保存到我的 VM 外部的目录中。我很抱歉没有早点弄清楚这一点。

【讨论】:

    猜你喜欢
    • 2021-09-01
    • 1970-01-01
    • 2021-07-02
    • 1970-01-01
    • 2017-05-29
    • 1970-01-01
    • 1970-01-01
    • 2015-09-24
    • 2016-09-04
    相关资源
    最近更新 更多