brophp设立404方法分享

WBOY
Release: 2016-06-13 13:05:20
Original
1011 people have browsed it

brophp设置404方法分享
今天一个同学问我brophp怎么设置404,这里分享一下方法
1,自己准备一个404页面的模板,放在根目录的public下面,当然路径你可以自己定义。
2,首先在action.class.php中添加这么一个方法:

  1. static public function _404(){
  2. header("HTTP/1.0 404 Not Found");
  3. header("status: 404 Not Found");
  4. $my = new self();
  5. $my->display('public/404');
  6. }

3,在brophp/brophp.php中找到 $srccontrolerfile = APP_PATH."controls/".strtolower($_GET["m"]).".class.php";后面添加下面的代码:
  1. if(!file_exists($srccontrolerfile)){
  2. Action::_404();
  3. }

4,然后打开action.class.php,找到Debug::addmsg("没有{$_GET["a"]}这个操作!");
这一行的上面或者下面添加:
  1. self::_404();

OK,完毕!
有问题上微博:@安正超


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template