我在服务器上安装了Laravel,我可以在web浏览器中导航到它的IP地址来查看我的页面。
我在Laravel的routes文件夹中编辑了web.php:
Route::get('/test', function() {
return view('test');
});当我访问http://[my server's IP]/test时,我得到的是404。
我有一个test.blade.php,它看起来像:
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
</head>
<body>
<h1>Hello</h1>
</body>
</html>我也用"/“测试了它,它可以工作,但我需要让它用"/test”工作。
我是不是应该换个别的东西而不是Laravel?除了持续不断的问题之外,我什么也没有遇到。很难相信它得到了如此广泛的应用。
我的php artisan route:list结果
+--------+----------+----------+------+---------+--------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+----------+------+---------+--------------+
| | GET|HEAD | api/user | | Closure | api,auth:api |
| | GET|HEAD | test | | Closure | web |
+--------+----------+----------+------+---------+--------------+发布于 2020-04-28 05:40:17
在更改路由后,您是否尝试过清除缓存?
php artisan cache:clear也可以试试
php artisan route:cachehttps://stackoverflow.com/questions/61468793
复制相似问题