如何覆盖CodeIgniter中未找到的页面? [英] How do I override the not found page in CodeIgniter?

查看:163
本文介绍了如何覆盖CodeIgniter中未找到的页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个CodeIgniter应用程序,一般工作我想要的,但偶尔,用户会去一个不存在的页面,并与一个不友好的错误。我想自动检测错误并向用户显示有用的信息(不是PHP错误)。我读了CodeIgniter的用户指南,但我找不到任何相关的部分。

I have a CodeIgniter application that's generally working how I'd like it to, but occasionally a user will go to a page that does not exist and is greeted with an unfriendly error. I'd like to detect the error automatically and display useful information to the user (not PHP errors). I read the user guide of CodeIgniter, but I couldn't find any relevant section.

如何处理CodeIgniter中的页面未找到的错误,并显示我自己自定义内容?

How do I handle a page-not-found error in CodeIgniter and display my own custom content?

推荐答案

如果您正在使用自己的自定义页面处理错误, application / errors 。如果您有基于自己代码的原因,可以使用 show_404 show_error - 请查看官方文档中的错误处理页面。

If you're looking at handling errors with your own custom page, you can modify the error templates found in application/errors. If you have a reason to based on your own code, you can manually send the user to one of these pages using show_404 or show_error - check out the Error Handling page in the official docs.

这篇关于如何覆盖CodeIgniter中未找到的页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆