【发布时间】:2019-04-24 20:24:32
【问题描述】:
我使用php artisan make:controller BoardController 生成了一个控制器
但是当我尝试访问 localhost/write 时出现 404 错误。
有人知道是什么问题吗?
web.php
Route::get('/', function () {
return view('index');
});
Route::get('write', 'BoardController@write');
BoardController
class BoardController extends Controller
{
public function write()
{
return view('write');
}
}
write.blade.php
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
this is write page
</body>
</html>
【问题讨论】:
-
您是否使用 Apache/Nginx 为应用程序提供服务?还是 php artisan serve ?还有,404是Laravel发出的页面还是web服务器发出的?
-
正如上面的评论,您使用什么来托管应用程序? nginx,阿帕奇?也许 wamp / xampp ?您的问题缺少此信息以帮助您使用您想要使用的环境
-
我使用 apache2 服务器。我想使用 apache,而不是 artisan。
-
我在 var/www/html 中复制了 laravel/public 文件。