gpt4 book ai didi

view - Laravel View 无法调用子文件夹 View

转载 作者:行者123 更新时间:2023-12-04 18:06:56 27 4
gpt4 key购买 nike

我在尝试从子文件夹调用 View 时遇到一些错误。首先,这东西能用

Route::get('/', function() { return View::make('sample'); });

但是当我尝试在这样的文件夹中调用它时

Route::get('/', function() { return View::make('pages.sample'); });

它会返回这样的错误:

[2014-06-08 16:00:43] production.ERROR: exception 'InvalidArgumentException' with message 'View [pages.sample] not found.' in /var/www/bootstrap/compiled.php:9076 Stack trace:
0 /var/www/bootstrap/compiled.php(9049): Illuminate\View\FileViewFinder->findInPaths('pages.sample', Array)
1 /var/www/vendor/laravel/framework/src/Illuminate/View/Factory.php(124): Illuminate\View\FileViewFinder->find('pages.sample')
2 /var/www/bootstrap/compiled.php(3225): Illuminate\View\Factory->make('pages.sample')
3 /var/www/app/routes.php(16): Illuminate\Support\Facades\Facade::__callStatic('make', Array)
4 /var/www/app/routes.php(16): Illuminate\Support\Facades\View::make('pages.sample')
5 [internal function]: {closure}()
6 /var/www/bootstrap/compiled.php(5098): call_user_func_array(Object(Closure), Array)
7 /var/www/bootstrap/compiled.php(4795): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
8 /var/www/bootstrap/compiled.php(4783): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
9 /var/www/bootstrap/compiled.php(706): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
10 /var/www/bootstrap/compiled.php(687): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
11 /var/www/bootstrap/compiled.php(7425): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
12 /var/www/bootstrap/compiled.php(8031): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
13 /var/www/bootstrap/compiled.php(7978): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
14 /var/www/bootstrap/compiled.php(10747): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
15 /var/www/bootstrap/compiled.php(648): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
16 /var/www/public/index.php(49): Illuminate\Foundation\Application->run()
17 {main} [] []

我尝试重新安装所有内容,但似乎不起作用。我错过了什么吗?谢谢!

最佳答案

我终于明白了。文件夹和文件不归“www-data”所有,这会导致此错误。这通常发生在您使用 LAMP 时。我希望这可以帮助任何遇到此类问题的人。对于任何想知道命令是什么的人:

sudo chgrp -R  www-data /var/www/app/views/* 

关于view - Laravel View 无法调用子文件夹 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24112372/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com