Custom 404 page in Lumen

后端 未结 3 1761
执笔经年
执笔经年 2021-02-04 08:13

I\'m new to Lumen and want to create an app with this framework. Now I have the problem that if some user enters a wrong url => http://www.example.com/abuot (wrong) => http://ww

3条回答
  •  温柔的废话
    2021-02-04 08:38

    I faced the same situation. response(view("errors.404"), 404)did not work for me, so I changed it as follows:

    public function render($request, Exception $exception)
    {
        if($exception instanceof NotFoundHttpException){
            return response(view('errors.404')->render(), 404);
        }
        return parent::render($request, $exception);
    }
    

提交回复
热议问题