问题描述
在我使用laravel 7.25创建项目之后(这是我第一次使用此版本,在上一个项目中使用7.20)之后,我在路由文件夹的web.PHP文件中创建了路由
Route::get('/',function () {
return view('welcome');
});
Route::get('/test',function () {
dd("k");
});
当我尝试运行它们时,只有“ /”起作用并且“ / test”找不到404,但是它在我的朋友设备上起作用,我使用xampp,这是apache httpd.conf:
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
AllowOverride All
Require all granted
</Directory>
解决方法
根据我们在评论中的交谈,我认为问题是您的路由函数没有return
值,因此它返回空页或404
。尝试将您的路线更改为此:
Route::get('/test',function () {
return dd("k");
});
详细了解official documentation上的路线,