普通网友 2016-06-15 19:16
浏览 104
已采纳

控制器操作方法中的404:Laravel 5.2.37

I have following Controller Action Method.

namespace App\Http\Controllers\API\SportsType;
class SportsTypeApiController extends \App\Http\Controllers\Controller
{
    public function apiSportsTypes() {
        return 1;
    }
}

Here is the route

Route::group(['prefix' => 'api/v1'], function () {
    Route::get('/apiSportsTypes', 'API\SportsType\SportsTypeApiController@apiSportsTypes');
});

It gives 404 error. Am I missing something? Please let me know if you need more details.

enter image description here

  • 写回答

1条回答 默认 最新

  • duanlie2709 2016-06-16 08:34
    关注

    It was happening because the routes were using cache. Due to that new routes were not even appearing in command prompt even if I was typing below command.

    php artisan route:list
    

    Then I had to remove the route cache by using the below command

    php artisan route:clear
    

    and now everything is working fine.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 R运行没有名称为"species"的插槽对于此对象类"SDMmodelCV"
  • ¥20 基于决策树的数字信号处理,2ask 2psk 2fsk的代码,检查下报错的原因
  • ¥20 python作业求过程
  • ¥15 wincc已组态的变量过多
  • ¥60 如图:直线与椭圆X轴平行,求直线与椭圆任意一点的相切坐标计算公式
  • ¥50 如何用python使用opencv里的cv::cudacodec::VideoWriter函数对视频进行GPU硬编码
  • ¥100 c#solidworks 二次开发 工程图自动标边线法兰 等折弯尺寸怎么标
  • ¥15 halcon DrawRegion 提示错误
  • ¥15 FastAPI Uvicorn启动显示404
  • ¥15 centos7.9脚本,怎么排除特定的访问记录