How to set up 404 in brophp _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Brophp sets the 404 method for sharing. Today, a classmate asked me how to set 404 in brophp. here I will share with you Method 1. prepare a 404 page template and place it under the public directory of the root directory, of course, you can define the path by yourself. Today, a student asked me how to set "404" in brophp. here I will share some ideas.
1. prepare a 404 page template and put it under the public directory of the root directory. of course, you can define the path yourself.
2. first add this method to action. class. php:
Static public function _ 404 (){
Header ("HTTP/1.0 404 Not Found ");
Header ("status: 404 Not Found ");
$ My = new self ();
$ My-> display ('public/100 ');
}

3. in brophp/brophp. in php, find $ srccontrolerfile = APP_PATH. "controls /". strtolower ($ _ GET ["m"]). ". class. php "; add the following code:
If (! File_exists ($ srccontrolerfile )){
Action: _ 404 ();
}

4. open action. class. php and find the Debug: addmsg ("No {$ _ GET [" a "]} operation! ");
Add above or below this line:
Self: _ 404 ();
OK!

Step 1: Prepare a 404 page template and put it under the public directory of the root directory. of course, you can define the path yourself...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.