久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Cakephp:我如何將所有丟失的控制器/動作調用路由

Cakephp: How would I route all missing controller/action calls to a single, general error page?(Cakephp:我如何將所有丟失的控制器/動作調用路由到一個單一的、通用的錯誤頁面?) - IT屋-程序員軟件開發技術分享
本文介紹了Cakephp:我如何將所有丟失的控制器/動作調用路由到一個單一的、通用的錯誤頁面?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個 cakephp 應用程序,每當 Cake 遇到任何錯誤(缺少控制器、動作等)時,我都會嘗試使用它來提供 Pages::404 函數(和相應的視圖)).

I've got a cakephp app that I'm trying to get to serve up the Pages::404 function (and corresponding view) whenever Cake encounters any error (missing controller, action, etc).

最好的方法是什么?

推薦答案

Cake 會因缺少方法或控制器而自動拋出 404 錯誤.在調試模式下,此錯誤采用包含說明的詳細錯誤消息的形式,例如:

Cake automatically throws a 404 error for missing methods or controllers. While in debug mode, this error takes the form of a detailed error message containing instructions, like:

缺少控制器

錯誤:找不到 FooController.

Error: FooController could not be found.

錯誤:在文件中創建下面的類 FooController:>應用程序/控制器/foo_controller.php

Error: Create the class FooController below in file: > app/controllers/foo_controller.php

注意:如果要自定義此錯誤信息,請創建 app/views/errors/missing_controller.ctp

Notice: If you want to customize this error message, create app/views/errors/missing_controller.ctp

在生產模式 (debug = 0) 中,消息如下所示:

In production mode (debug = 0) the message just looks like this:

未找到

錯誤:在此服務器上找不到請求的地址/foo".

Error: The requested address '/foo' was not found on this server.

這些錯誤頁面在 cake/libs/view/errors/ 中定義.正如調試模式中的消息所說,您可以在 app/views/errors/ 中創建自己的自定義錯誤頁面(使用與 cake/ 目錄中的名稱相同的名稱)代碼>.

These error pages are defined in cake/libs/view/errors/. As the message in debug mode says, you can create your own, custom error pages (using the same name as the ones in the cake/ directory) in app/views/errors/.

如果您想對錯誤執行自定義函數,最好將其放入 AppError 控制器中,如 錯誤處理.

If you want to execute a custom function on errors, you'll best put it in the AppError Controller as described in Error Handling.

這篇關于Cakephp:我如何將所有丟失的控制器/動作調用路由到一個單一的、通用的錯誤頁面?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Cannot use #39;Object as class name as it is reserved Cake 2.2.x(不能使用 Object 作為類名,因為它是保留的 Cake 2.2.x)
Session is lost after an OAuth redirect(OAuth 重定向后會話丟失)
Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分頁排序)
CakePHP Shared core for multiple apps(CakePHP 多個應用程序的共享核心)
Login [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登錄 [ Auth-identify() ] 始終為 false)
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命錯誤:允許的內存大小為 134217728 字節已用盡(嘗試分配 87 字節))
主站蜘蛛池模板: 精品一区二区三区在线观看国产 | av一区二区三区 | 免费一区二区三区 | 久久精品国产久精国产 | 91网站在线看 | 成人av播放| 欧美三级在线 | 亚洲一区久久 | 欧美日韩视频在线播放 | 激情91| 亚洲成人国产精品 | 91精品国产综合久久精品 | 日韩在线 | 人人爽日日躁夜夜躁尤物 | 伦理午夜电影免费观看 | 伊人久久精品一区二区三区 | 一级黄色毛片子 | 午夜亚洲| 伊人网站在线观看 | 中文字幕视频网 | 国产精品视频久久久 | 久久久久久久久久久高潮一区二区 | 欧美精品一区二区三区蜜臀 | 国产 欧美 日韩 一区 | av免费电影在线 | 成人不卡视频 | 99国产精品99久久久久久粉嫩 | 狠狠躁夜夜躁人人爽天天高潮 | 久草免费福利 | 一级看片 | 黄色毛片免费看 | 国产你懂的在线观看 | 在线观看中文字幕亚洲 | 成年人在线视频 | 欧美精品一区二区三区四区五区 | 成人在线免费视频观看 | 国产欧美视频一区二区 | www.国产精 | 国产精品成人一区二区 | 亚洲一区二区三区乱码aⅴ 四虎在线视频 | 亚洲风情在线观看 |