Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Laravel Framework 5.4 Custom error Page setup

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Encountered in the development of if this connection is the correct access address

Http://localhost/cky/ckyweb/public/admin/userlist?page=2

Then an error message will appear if I casually add a character at the end of this connection.

This is not allowed after the website is launched, so it is set up and distributed according to the definition error information page of the laravel framework.

First, you need to define the view view page, 404.blade.php page.

Then you need to find the Handler.php file in the Exceptions directory in the app directory and enter the file to modify the render method in this file.

The details are as follows:

Public function render ($request, Exception $exception) {if ($exception) {return response ()-> view ('error.'.$exception- > getStatusCode (), [], $exception- > getStatusCode ());} return parent::render ($request, $exception);}

Note:

If your custom page has parameters, you need to go through the

Return response ()-> view ('error.'.$exception- > getStatusCode (), [' parameters, parameters.'], $exception- > getStatusCode ()

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report