PHP uses the header to redirect to invalid solutions. phpheader jump to invalid _ PHP Tutorial

Source: Internet
Author: User
PHP uses the header redirection failure solution to disable the phpheader redirection. PHP uses the header jump failure solution. phpheader jump failure this article describes how PHP uses the header jump failure solution and shares it with you for your reference. Analysis of specific methods PHP uses the header to redirect to invalid solutions, phpheader jump to invalid

The example in this article describes how PHP uses the header to redirect to an invalid solution and shares it with you for your reference. The specific method is analyzed as follows:

I. problems:

Today's header (\ "Location: $ url \"), the previous jump is always possible, but today it does not move, only the output results, in the past you have to confirm the check, the $ url value is obtained correctly. Therefore, echo $ url is added in front of the url for debugging. as a result, the header function is invalid.

II. solution:

When using header ("location: test. PHP") in php to redirect, pay attention to the following points:

1. no space is allowed between location and:; otherwise, an error occurs. // phpfensi.com

2. there cannot be any output before using the header, including the "?>" tag on the include page" There cannot be spaces.

3. the PHP code after the header is executed.

No content can be output before the PHP header jump, because the HTTP header information has been sent to the browser at the beginning of PHP execution and cannot be changed.

However, if you have to process the header information after the output, you can use ob_start () ob_end_flush () to cache the content to be sent and wait until the header continues to send the content.

Or a simpler method is to modify php. ini and find output_buffering = Off and change it to output_buffering = 4096.

I hope this article will help you with PHP programming.


Php header () page jump

If you are sure you want to use the post method for submission, it is very complicated. because php is required to simulate post submission, you can use fsockopen for processing. I can teach you the specific solution.
Another method is to use the get solution. In contrast, it is a super simple method. when you directly turn to the method, you can convert the post data to the get header.
Another solution is to use ajax in the previous section. Submit data to B in ajax on page. php, according to the return value indicates that the page is not verified, and then the js is used to convert the page to B. php. if the returned value indicates that the verification is successful, submit the data of the current post to c. php.

Php header cannot be redirected. it is okay on the local machine, but there is a problem when uploading to the server. it cannot be redirected. you have to refresh the page to jump to the specified page.

Encoding problem changed charset = UTF-8 to charset = GB2312

Examples in this article describe how PHP uses the header to jump to the invalid solution and share it with you for your reference. Analysis of specific methods...

Related Article

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.