在thinkphp框架中添加404页面的方法

2013 年 2 月 27 日3810

在thinkphp框架中添加404页面的方法

最近在用thinkphp框架完成了一个项目,需要在项目中添加404页面,在网上搜索了在thinkphp框架中添加404页面的方法,在这里记录一下。

最近在用thinkphp框架完成了一个项目,需要在项目中添加404页面,在网上搜索了在thinkphp框架中添加404页面的方法,在这里记录一下。

第一步:

在Lib/Action文件夹下创建EmptyAction.class.PHP

<?php

class EmptyAction extends Action {

function _empty(){

header("HTTP/1.0 404 Not Found");

$this->display('empty:index');

}

// 404

function index() {

header("HTTP/1.0 404 Not Found");

$this->display('empty:index');

}

}

第二步:

修改Lib/Action文件夹下所有的Action文件,在所有的控制器文件中加入如下代码:

function _empty()

{

header("HTTP/1.0 404 Not Found");

$this->display('empty:index');

}

第三步,

在Tpl/empty文件夹下创建404页面index.html

关键词:thinkphp404

相关阅读:

赞助商链接:

0 0