PHP Error Interface detailed instructions, PHP error details _php tutorial

Source: Internet
Author: User
Tags php error

PHP Error Interface detailed instructions, PHP error details


One of the most common errors on the Web is the invalid link. Once an invalid link appears from another site, you will reschedule your
of the site. People will store their favorite sites in a book, if they visit again after three months, only to find that ' 404 Not fount '
, they will not be given the task help and tell them how to find the original information from your site. Let's solve this problem, or at least
Give your users a friendly help, and once they encounter a ' a 404 ' error, they can get some traces. You can create a normal page to
Reports all errors that are encountered while processing your page.

PHP is free to create your own error page with Apache, but it needs to be reconfigured and a small number of generations
Code. Let's learn the configuration section first.

Apache's errordocument indicates which document (or URI) Apache should redirect to when an error occurs. It allows you
Specify a resource for each error code that your users may encounter. By adding a errordocument 404 to Your server configuration
/error.php instructions. This will redirect to ' error.php ' when the user accesses a nonexistent page, and we'll write
' error.php ' page. Do not forget to restart Apache for the changes to take effect.

Next, we write a simple error.php:

The file that you requested ( ) does not exist on this server.
Please find the file you want from the front page.

Now try to read a page that does not exist on your server, how, you can see error.php, it has a good and
Friendly message, and there is a link to the previous page.

Let's extend it a bit. As you can see, I used the Redirect_url variable in error.php. This variable is Apache in
A errordocument indicator is executed, and a possible way to find the original resource is provided. In this case, Apache
Also set some other variables, all of which can be found here. Using these variables may create a good error page for
User A nice and friendly error page instead of the default page given by Apache.

Output Error from PHP page
Output error from a PHP page is similar to simulating Apache's errordocument instructions, so you simply redirect the user
By using the query-string variable, Apache is usually set inside the environment variable. This allows you to use the same error page to place
All kinds of mistakes. Here 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 output buffering to output errors anywhere on this page

if (!condition) {
Throw_error ("The condition Failed");
}

Ob_end_flush ();
Page processing complete, refresh output buffer
?>
Using the output buffering characteristics of the PHP4 is also helpful in generating general error reporting. But after you confirm that the entire error page has been processed,
, do not forget to flush the buffer, you can use the header to redirect in any place in your code.

Detailed Description: http://php.662p.com/thread-333-1-1.html


Problems with PHP jump page

a.php (Registration page)

b.php (Processing page, at the end there are two methods of jumping)

The code is here (delete unnecessary tests)
a.php
Test</title>

Name:
Gender:
Age:
Address:
</form> Location ... Remaining full text >>


PHP Page Usage Framework Issues

When the parent page refreshes, each element on the page is re-loaded, including the IFRAME element on the parent page, then the inline page of the natural iframe is re-loaded, because the SRC attribute of the IFRAME is re-loaded once.
In fact, you can use Ajax to regularly update some of the specific information on the parent page, the parent page of the IFRAME do not update, and the iframe src unchanged, then the child page will not be refreshed.

http://www.bkjia.com/PHPjc/833841.html www.bkjia.com true http://www.bkjia.com/PHPjc/833841.html techarticle PHP Error interface details, PHP error detailed description on the Web one of the common errors is invalid link. Once an invalid link appears from another site, you will reschedule ...

  • 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.