You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel 10路由异常:/files/create突然跳转至404页面求助

问题:/files/create路由突然返回404,已尝试多种方案无效

我已用尽办法,除了回滚整个应用至正常状态外,几乎尝试了所有能找到的方案。/files/create路由突然返回404页面而非正常内容,如需更多信息请告知。

已尝试的操作

  • 清除路由缓存(及所有缓存)
  • 将中间件组置于带参数路由之上
  • 测试其他带auth中间件的路由,以及移除该路由的auth中间件
  • 测试其他/files路由(均可正常访问)
  • 反复检查所有相关内容的存在性及拼写(路由、方法等)
  • 执行php artisan optimize命令
  • 执行php artisan route:list命令确认路由存在
  • 停止并重启服务器

相关代码与结构

web.php 路由配置

Route::controller(FileController::class)->group(function () {
    Route::get('/files', 'index');
    Route::get('/files/{id}', 'show');
    Route::get('/files/{id}/preview', 'preview');
    Route::middleware('auth')->group(function () {
        Route::get('/files/create', 'create');
        Route::post('/files/create', 'store');
    });
});

FileController.php 对应方法

public function create()
{
    return view('file.create');
}

文件结构

目标视图存储于resources\views\file\create.blade.php,resources\views\file下的其他所有视图均可正常访问。


内容的提问来源于stack exchange,提问作者Jacob Knox

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 11:30:07