简体   繁体   English

为什么laravel 5.7基本路由重定向到404?

[英]Why laravel 5.7 basic route redirect to 404?

i have install fresh laravel 5.7. 我已经安装了新鲜的laravel 5.7。 now when i declare route in web.php. 现在,当我在web.php中声明路由时。 when i declare like 当我宣布喜欢

Route::get('foo', function () {
    return 'Hello World';
});

it redirect to 404 page but.. when i declare my root directory name along with route just like 它重定向到404页面,但是..当我声明根目录名称以及路由时,就像

Route::get('blog/foo', function () {
    return 'Hello World';
});

it shows me expected result.. 它显示了我的预期结果。

but i don't want to define like that. 但我不想这样定义。 i want to define like this and get the expected result 我想这样定义并获得预期的结果

  Route::get('foo', function () {
        return 'Hello World';
    });

help me ! 帮我 !

它应该可以正常工作,但是尝试以下命令,让我知道它是否解决了您的问题

php artisan route:clear

应该有一条类似/{someParam}的路线将您的路线'/foo'上移,以便将其放置在param /{someparam}路线上方

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM