search
Homephp教程php手册ThinkPHP访问不存在的模块跳转到404页面的方法

这篇文章主要介绍了ThinkPHP访问不存在的模块跳转到404页面的方法,需要的朋友可以参考下

首先在ACTION中新建一个文件EmptyAction.class.php,其代码如下:

display("Public:404"); } } ?>

使用apache服务器的情况下需在apache中的网站配置中加入 ErrorDocument 404 /404.html 即可。

使用iis服务器的情况下需在iis中的IIS/ASP.net下设置404错误页面。

打开apache httpd.conf配置文件或者新建.htaccess配置文件

首先,修改应用程序根目录的设置,打开 “web.config” 文件编辑,在其中加入如下内容:

注:上文例中“error.asp”为系统默认的404页面,“notfound.asp”为自定义的404页面,,使用时请修改相应文件名。
然后,在自定义的404页面“notfound.asp”中加入:

php的404页面:

if(//如果没有任何结果) { //以前是仅仅显示“该帖子已经不存在”的提示,现在是: require('/404.php'); @header('HTTP/1.1 404 Not Found''); @header('Status: 404 Not Found'); exit; }

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function