PHP download.php Implementation code jump to download file (Response.Redirect) _php tips

Source: Internet
Author: User
Tags php download
Jump core code implementation.
Copy Code code as follows:

if (Isset ($link))
{
Header ("http/1.1 303 and Other");
Header ("Location: $link");
Exit
}



The following is a foreign article description.
Hey Chris:
On Wed, 12:28:19pm-0500, Csnyder wrote:
>
> <?php
>//Process form
> ...
>//Redirect to results page
> Header (' http/1.1 303 and Other ');
> Header (' Location:result.html ');
> Exit (' Form submitted, <a href= ' result.html ' >continue</a>. ');
>?>
Good point. But some feedback here. The Optimail syntax is:
<?php
Process form
// ...
Redirect to results page
Header (' status:303 = Other ');
Header (' location:http://www.jb51.net/result.html ');
?>
Here ' s why ...
Using "Status:" In the header is better because the resulting headers from
Apache are more correct:
http/1.1 303
Instead of
http/1.1 303
Additionally, one doesn ' t really know which version of HTTP is being used,
So why potentially cause problems by trying to guess.
The specs say location headers must have a complete URI in them, not just
The path.
Lastly, you don ' t want any output after the location header.
Later,
--dan

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.