Laravel 4 Quick Tip: Custom Error Pages

App::error(function($exception, $code)

{

switch ($code)

{

case 403:

return Response::view(‘errors.403‘, array(), 403);

case 404:

return Response::view(‘errors.404‘, array(), 404);

case 500:

return Response::view(‘errors.500‘, array(), 500);

default:

return Response::view(‘errors.default‘, array(), $code);

}

});

时间: 2024-11-05 20:40:59

Laravel 4 Quick Tip: Custom Error Pages的相关文章

Demystifying ASP.NET MVC 5 Error Pages and Error Logging

出处:http://dusted.codes/demystifying-aspnet-mvc-5-error-pages-and-error-logging Error pages and error logging, both so elementary and yet so complex in ASP.NET MVC. Perhaps complex is not entirely true, but it is certainly not very straight forward fo

Android Quick Tip - ADB over WiFi

http://stuffandtech.blogspot.jp/2012/03/android-quick-tip-adb-over-wifi.html MAR 26 Android Quick Tip - ADB over WiFi Someone I had the pleasure of working with recently showed me something extremely cool for Android development. It is simply that it

在ASP.NET Core使用Middleware模拟Custom Error Page功能

一.使用场景 在传统的ASP.NET MVC中,我们可以使用HandleErrorAttribute特性来具体指定如何处理Action抛出的异常.只要某个Action设置了HandleErrorAttribute特性,那么默认的,当这个Action抛出了异常时MVC将会显示Error视图,该视图位于~/Views/Shared目录下. 自定义错误页面的目的,就是为了能让程序在出现错误/异常的时候,能够有较好的显示体验.有时候在Error视图中也会发生错误,这时ASP.NET/MVC将会显示其默认

Quick Tip: How to Add Syntax Highlighting to Any Project

Quick Tip: How to Add Syntax Highlighting to Any Projectpublic String showAllArticleForPage() throws Exception{HttpServletRequest request = ServletActionContext.getRequest();String username=(String) ActionContext.getContext().getSession().get("user&q

laravel --报错:Parse error: syntax error, unexpected '}', expecting ';'

报错如下: 原因:少了一个 ' ; ' laravel --报错:Parse error: syntax error, unexpected '}', expecting ';' 原文地址:https://www.cnblogs.com/daikiti/p/8970600.html

laravel --报错:Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW)

报错如下: 原因:( ) { } [ ] 不对称,或者用错了. laravel --报错:Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) 原文地址:https://www.cnblogs.com/daikiti/p/8970576.html

eclipse error pages打红X的解决方法

我每次建一个Maven项目转为web项目的时候,这里总有这么多文件,而且还会有一个Error Pages的错红的红叉,看着很不爽.虽然项目中没有出现过错误,但是对于我来说,始终是个错误信息.于是我找了好久,终于找到问题的原因. 原来这是eclipse自身的问题,你要是转为web项目时,增加了web.xml,可是编译器不会自己更新,会报这个错误.因此,你可以裁剪web.xml的所有信息,在Ctrl+s保存,然后编译器就会刷新了,然后你在把裁剪的内容在重新放回web.xml中,最后问题解决. 原文地

[Hapi.js] Friendly error pages with extension events

hapi automatically responds with JSON for any error passed to a route's reply()method. But what if your application needs errors rendered in HTML? This lesson shows how to implement friendly HTML error messages using hapi extension events. const Hapi

laravel migrate时报错:Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

在按照文档执行php artisan migrate时报错. SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`)) 解决方法 namespace App\Providers; use Illum