Home Backend Development PHP Tutorial brophp设立404方法分享

brophp设立404方法分享

Jun 13, 2016 am 10:58 AM
404 action quot

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,完毕!
有问题上微博:@安正超


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

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Is the 404 code a front-end or back-end problem? Is the 404 code a front-end or back-end problem? Jun 12, 2023 pm 01:53 PM

404 codes are situation-specific and can be either front-end or back-end issues. In some cases, 404 errors can come from problems on the client side, such as spelling in the URL path that results in the page not being found. In other cases, , 404 errors may be caused by the web application not responding to the request correctly, such as missing interface implementation or empty database query results.

DJI Osmo Action 5 Pro: Release date mooted as retailer reveals launch pricing that could undercut GoPro Hero 13 Black DJI Osmo Action 5 Pro: Release date mooted as retailer reveals launch pricing that could undercut GoPro Hero 13 Black Sep 04, 2024 am 06:51 AM

DJI has not confirmed any plans to introduce a new action camera yet. Instead, it seems that GoPro will get ahead of its rival this year, having teased that it will introduce two new action cameras on September 4. For context, these are expected to a

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

New DJI Osmo action camera spotted before probable summer 2024 launch to rival recent GoPro and Insta360 releases New DJI Osmo action camera spotted before probable summer 2024 launch to rival recent GoPro and Insta360 releases Jul 01, 2024 am 09:49 AM

Almost a year has passed since DJI released the Osmo Action 4 (curr. $299 on Amazon). Since then, the company has focused on its other divisions, including new RS camera gimbals. On top of that, it has introduced various drones as well like the Avata

How to open a 404 website How to open a 404 website Sep 11, 2023 pm 03:49 PM

How to open a 404 website: 1. Choose a browser according to your preference; 2. You need to know the URL address of a 404 website, or search for "404 website list" or "random URL generator" in the search engine to find The addresses of some 404 websites; 3. Enter the address in the address bar of the browser, and then press the Enter key. The browser will try to connect to the address and return a 404 error page; 4. Before opening the 404 website, make sure The computer has the latest anti-virus software installed, and the browser's security settings are turned on.

Common causes and solutions for php 404 errors Common causes and solutions for php 404 errors Mar 23, 2023 pm 05:20 PM

In the process of developing websites using PHP, 404 file or directory not found errors often occur. This error is usually caused by the file or directory not existing or the permissions of the file or directory being incorrect. This article will detail the common causes, solutions, and preventive measures for PHP 404 errors.

How to enter the 404 website How to enter the 404 website Oct 31, 2023 am 11:58 AM

Solution: 1. Refresh the page; 2. Clear cache and cookies; 3. Use alternative URLs; 4. Use search engine cache, etc.

Detailed explanation of Action asynchronous operation of Vuex state management Detailed explanation of Action asynchronous operation of Vuex state management Aug 10, 2022 pm 03:29 PM

In some cases, we want to perform some asynchronous operations in Vuex, such as network requests, which must be asynchronous. How to deal with this situation? Let me introduce to you the Action asynchronous operation of Vuex state management. I hope it will be helpful to friends in need. !

See all articles