PHP header () function

Source: Internet
Author: User

For the header function, I use most of the jump page and set character sets, the other functions used relatively little.

One, set character sets

In fact, we use the most in the HTML code in the <meta> tag inside the character set. The format is as follows:

<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>

This is the XHTML format because the META tag is a single label, so add '/' close <meta> tag later.

But if you are testing on this machine, you do not need to add such a long attribute, use the following simplified version.

<meta charset= "UTF-8" >

The above is set in the code of the HTML character sets, if it is pure PHP code, set character sets will have to use the header function. The format is as follows:

Header ("Content-type:text/html;charset=utf-8");

In fact, the contents of the header function is HTML <meta> tags in the content of the integration, just remember one can, the other does not have to remember.

Second, jump page

In addition to the jump page can be implemented with <a></a> tags, the format is as follows:

<!--<a href= "url" >urlName</a>--><a href= "http://www.cnblogs.com/-beyond/" > Search beyond</a >

You can also use the header function, at which point the JavaScript location object is used. The format is:

Header ("Location:url"); Header ("location:http://www.cnblogs.com/-beyond/");

PHP header () function

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.