PHP error page details, php error details _ PHP Tutorial

Source: Internet
Author: User
PHP error page details, php error details. PHP error page details. php error details: one of the common errors on the web is invalid links. Once an invalid link appears from other sites, you will reschedule the PHP error page for detailed descriptions, php error details

One of the common errors on the web is invalid links. Once an invalid link appears from another site, you will reschedule
. People will save their favorite sites as bookmarks. if they visit the site again three months later, they will only find that '2017 Not Fount'
They will not be given task help, telling them how to find the original information from your site. Let's solve this problem, or at least
Give your users a friendly help. once they encounter the 'A 404 'error, they will be able to get some trace. You can create a normal page
Report all errors encountered when processing your page.

PHP and Apache allow you to create your own error page with great freedom, but you need to re-configure the page and compile a few generations.
. Let's first learn about the configuration section.

Apache ErrorDocument indicates the document (or URI) to which Apache redirects when an error occurs ). It allows you
Specify a resource for the error code that your users may encounter. By adding an ErrorDocument 404 in your server configuration
/Error. php instructions. This will be redirected to 'error. php' when the user accesses a page that does not exist. below we will write
'Error. php' page. Do not forget to restart Apache to make the change take effect.

Next, let's write a simple error. php:

The file you requested ( ) Does not exist on this server.
Find the file you want from the front page.

Now I try to read a page that does not exist on your server. how can I see error. php? it has a good
A friendly message with a link to the previous page.

Let's extend it. As you can see, I used the REDIRECT_URL variable in error. php. This variable is used by Apache in
When an ErrorDocument directive is executed, it provides a possibility to locate the original resource. In this case, Apache
Some other variables are also set. all variables can be found here. Using these variables may create a good error page
The user has a good and friendly error page, instead of the default page provided by Apache.

Output error from PHP page
Outputting errors from a PHP page is similar to simulating Apache's instructions on ErrorDocument. you just need to simply redirect users,
By using the query-string variable, Apache is usually set in the environment variable. In this way, you can use the same error page
Handle various errors. The following is an example:




Function throw_error ($ message ){
$ Error_page = "/err/error. php ";

$ Error_url = $ error_page;
$ Error_url. = "? REDIRECT_ERROR_NOTES = $ message ";
$ Error_url. = "& REDIRECT_URL =". $ GLOBALS ["PHP_SELF"];
$ Error_url. = "& REDIRECT_REQUEST_METHOD = $ REQUEST_METHOD ";
$ Error_url. = "& REDIRECT_STATUS = 501 ";
Header ("Status: 501 ");
Header ("Location: $ error_url ");
Exit;
}

Ob_start ();
// Use the output buffer to output errors anywhere on this page

If (! Condition ){
Throw_error ("the condition failed ");
}

Ob_end_flush ();
// After Page processing is completed, refresh the output buffer
?>
Using the output buffer feature of PHP4 can also help generate common error reports. However, the entire error page has been processed.
Do not forget to refresh the buffer. you can use the Header call to redirect any part of your code.

Http://php.662p.com/thread-333-1-1.html


Php jump page problems

A. php (registration page)

B. php (processing the page. There are two jump methods at the end)

The code is here (delete unnecessary ones and test them)
A. php
Test </title>

Name:
Gender:
Age:
Address:
</Form> >


Php page usage framework

After the parent page is refreshed, every element on the page will be reloaded, including the iframe element on the parent page. then, the embedded page of the natural iframe will be reloaded and refreshed, because the src attribute of iframe is reloaded once.
In fact, you can use ajax to regularly update some specific information on the parent page. the iframe of the parent page should not be updated, but the src of iframe will not change, so the child page will not be refreshed.

One of the common web errors of Ingress is invalid links. Once an invalid link appears from another site, you will reschedule it...

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.