【问题标题】:PHP Laravel route after installation安装后的 PHP Laravel 路由
【发布时间】:2021-05-21 14:34:52
【问题描述】:

我安装了新的 laravel 项目(“Starter”)并想通过输入这个 URL 来查看“欢迎”页面。

http://localhost/starter/

当路由如下时页面运行良好。

Route::get('/', function () {
    return view('welcome');
});

但是,当我在 (/) 之后写任何东西时...

Route::get('/test', function () {
    return view('welcome');
});

并通过网址查看:

http://localhost/starter/test

页面不工作并显示...

404
Not Found

有什么想法吗?

【问题讨论】:

  • 尝试运行php artisan route:list并显示输出
  • 这里http://localhost/starter/test /starter 来自哪里?应该是http://localhost/test
  • C:\xampp\htdocs\Starter>php artisan route:list +--------+---------+------- ---+--------+---------+------------+ |域名 |方法 |网址 |姓名 |行动 |中间件 | +--------+----------+----------+------+---------+- ------------+ | |得到|头| / | |关闭 |网站 | | |得到|头| api/用户 | |关闭 |接口 | | | | | | |身份验证:api | +--------+----------+----------+------+---------+- ------------+
  • 也许你需要使用localhost/starter/public/test
  • 我从 URL 中删除了“公共”路径

标签: php laravel url routes backend


【解决方案1】:

URL中word(starter)中的(s),Laravel项目名称应为大写(Starter)

【讨论】:

    猜你喜欢
    • 2016-06-08
    • 2018-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-04
    • 2020-11-09
    • 2012-08-16
    • 1970-01-01
    相关资源
    最近更新 更多