Laravel:错误 InvalidArgumentException

问题描述 投票:0回答:6

我将项目从本地主机上传到我的专用服务器,经过这么多问题,终于有些页面可以工作了domain.com |域名.com/home | domain.com/allsites 等..

但是现在,路由“domain.com/site/create” 找不到“domain.com/site/ID/manage”、“domain.com/site/ID/edit”,我收到此错误,为什么?

FileViewFinder.php 第 137 行中出现 InvalidArgumentException:未找到视图 [Site.create]。

在 FileViewFinder.php 第 137 行
FileViewFinder->findInPaths('Site.create',
array('/....../resources/views')) 在 FileViewFinder.php 第 79 行
Factory.php 第 151 行中的 FileViewFinder->find('Site.create')

我尝试了 artisan 命令:cache:clear、route:clear、config:clear、config:cache 但没有任何效果,我不知道问题出在哪里!

在本地主机上它运行完美

php laravel migration hosting
6个回答
15
投票

还多次发现配置缓存有问题。使用以下命令来微调它们。

php artisan config:cache
php artisan config:clear

14
投票

如果您的本地操作系统与生产服务器操作系统不同,您可能会遇到区分大小写的问题,并且找不到文件。确保您的文件名大小写完全相同。这种情况尤其可能发生在一个环境是 Mac 而另一个环境是 Linux 的情况下。

如果问题仍未解决,请访问以下链接。或许对你有帮助

Laravel 5 - 查看[home]未找到

Laravel 5.1 未找到视图

Laravel 5 FileViewFinder.php 第 137 行中的 InvalidArgumentException:未找到视图 [.admin]


2
投票

我遇到了同样的问题,但原因不同。对我来说,问题是

errors
文件夹的权限。特别是该文件夹不可执行。

在 Linux 上解决:

$ chmod +x ../views/errors

0
投票

尝试以下命令之一:

php artisan dump-autoload
composer dump-autoload


0
投票

检查您传递的参数是否在数据库字段中!

 $mailData = array(
                    'type' => 'email_subscription',
                    'user_mail' => $obj->email_id
                );
                
                Mail::to($request->input('email'))->send(new SendMail($mailData));

0
投票

就我而言,我用大写字母写控制器的名字。

Route::**C**ontroller(ProductsController::class)->group(function(){ Route::get('/','index')->name('home'); }); 
我刚刚将名称更新为
Route::controller(ProductsController::class)->group(function(){ Route::get('/','index')->name('home'); }); 
,现在效果很好。

© www.soinside.com 2019 - 2024. All rights reserved.