【问题标题】:Laravel - Page Not Found after changing project nameLaravel - 更改项目名称后找不到页面
【发布时间】:2018-09-30 10:25:34
【问题描述】:

我更改了我的 Laravel 项目名称:php artisan app:name new_name

我的项目显示错误:

Class 'app\Providers\EloquentEventServiceProvider' not found

我做了一些研究,在 StackOverflow 上找到了一个已回答的问题,建议我删除 /bootstrap/cache/config.php 文件。

我删除它并通过php artisan config:cache重新生成

现在我的项目正在展示

抱歉,找不到您要查找的页面。

我的路线/web.php 看起来像:

/** Auth Routes*/
Auth::routes();

/** Homepage Route*/
Route::get('/', function () {
    return view('layout');
});

我的 .htaccess 文件如下所示:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    RewriteBase /

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

请帮帮我!

【问题讨论】:

  • composer du 应该可以工作。如果您要使用php artisan app:name NewName,则不必使用composer du,它也可以正常工作。
  • 仍然收到Sorry, the page you are looking for could not be found.
  • 您确定“布局”是视图的名称吗?不是“layouts.layout”之类的吗?

标签: php laravel .htaccess caching configuration


【解决方案1】:

你可以试试下一个命令:

php artisan route:clear

【讨论】:

  • 好吧,接下来试试: 1)php artisan route:clear ; 2)作曲家转储自动加载。它能解决你的问题吗?
  • 仍然收到Sorry, the page you are looking for could not be found.
【解决方案2】:

试试

php artisan config:clear

并更改Class 'app\Providers\EloquentEventServiceProvider' to Class 'App\Providers\EloquentEventServiceProvider' 看看有没有效果

【讨论】:

  • 我在删除 /bootstrap/cache/config.php 时摆脱了那个错误现在我得到:Sorry, the page you are looking for could not be found.
  • 我猜你是在本地开发的/htdocs/yourAppName 与您在 config/app.php 文件中的名称相同。或者只是仔细检查页面的名称是否与您从控制器返回的页面名称相同。还要仔细检查 url您页面上的网址与您的 web.php 文件中的网址匹配。只是一些建议
猜你喜欢
  • 2012-06-04
  • 1970-01-01
  • 2020-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多