For the header function, I use most of the jump page and set character sets, the other functions used relatively little.One, set character setsIn fact, we use the most in the HTML code in the tag inside the character set. The format is as
Analysis of PHP header output
"; Header ('Location: http://www.baidu.com ');/* but run the above found successful jump name, because this does not conform to the HTTP specification of the HTTP header, it is likely that the entire HTTP Response
Use of the PHP header function
The cache of the Web page is controlled by the "Cache-control" in the HTTP message header, and the common values are private, No-cache, Max-age, must-revalidate, etc., and the default is private. Its function is
If you have just started to learn PHP, there may be many functions need to study, today we will learn how to use the PHP Header (), more instructions, please refer to the PHP Chinese manual, the following is a detailed use of the header function
PHP Header Jump IE problem
Movie Station offers the movie BT download, due to the use of the Polaroid player, upload a movie when uploading a movie hash file. Using this hash file, the first time the request is dynamically generated, the
PHP page encoding declaration differs from PHP page encoding using header or meta.
PHP header to define a PHP page as UTF or GBK EncodingThe PHP page is UTF encoded.Header ("Content-Type: text/html; charset = UTF-8 ″);
The PHP page is GBK
This article introduces the contents of the PHP header () 7 kinds of usage, has a certain reference value, now share to everyone, the need for friends can refer to
7 Ways to use PHP headers
1. Jump page
Header (' Location: '. $url); There is no
$filename = ' path + actual filename ';
Types of files
Header (' content-type:application/pdf ');
Download the displayed name
Header (' content-disposition:attachment; filename= ' save file name. pdf "');
ReadFile
Regardless of how many headers the page has, it executes the last one, but conditionally, for example:
Header (' location:http://www.jb51.net ');
Header (' location:http://www.g.cn ');
Header (' location:http://www.baidu.com ');
This will jump to
Copy CodeThe code is as follows:
/*** function:php Header () examples (PHP)* * Desc:some examples on what to use the header () function of phpyou find a detailed tutorial at expertsrt.com (中文版) o R at Ffm.junetz.de (German). These is also a good
In the previous article, we introduced the header function in PHP, as well as the definition of header, there are many ways to use the header in PHP, today we introduce the header method in PHP to achieve page jump case,
This article analyzes the
In the PHP language, the header () function is useful, especially when using Ajax, and he will help you solve some unexpected problems. Here are some detailed explanations of the header. Hope to be helpful to Phper
Copy the Code code as follows:
Header ("location:http://bbs.it-home.org";);
Exit After each redirect, "Exit" must be added to avoid an error and continue execution.
?>
Header ("refresh:3;url=http://bbs.it-home.org");
Print (' Loading, please
Set the content-type of common file types in php headers. This article describes how to set the content-type for common file types in php headers, for more information about how to set the content-type of common file types, see header in php.
This
Summary of common PHP header definitions and phpheader Headers
The header () function sends the original HTTP header to the client.
It is important to realize that the header () function must be called before any actual output is sent (in PHP 4 and
PHP header () Usage tips
The following is a detailed description of the use of the header function:
Regardless of how many headers the page has, it executes the last one, but conditionally, for example:
This will jump to Baidu
The role of the
PHP header send various types of files and settings file download name
Header (' content-type:application/image/pjpeg ');//type of outputHeader (' content-disposition:attachment; filename= ' downloaded.jpg '); Download the displayed name,
First, let's look at the header function.The header () function sends the original HTTP header to the client, header (string, replace, http_response_code)Php header 404:Php code The code is as follows:Copy code Header ("HTTP/1.1 404 Not Found");
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.