/**
Desc:header functions to set various HTTP headers
link:bbs.it-home.org
Date:2013/2/24
*/
Defining the Encoding
Header (' Content-type:text/html;charset=utf-8 ');
Atom
Header ('
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
This article mainly introduces the PHP header () function commonly used methods. Summed up the common usage, the need for friends can refer to the following Define coding Code as follows: Header (' content-type:text/html;charset=utf-8 '); Atom
Example of setting various HTTP headers using the header function in php
/**
Desc: header function to set various HTTP headers
Link: bbs.it-home.org
Date:
*/
// Define the encoding
Summary of common methods for PHPheader () functions. Definition code copy code: header (Content-Type: texthtml; charsetutf-8); Atom copy code: header (Content-type: applicationatom + xml ); CSS copy // define the encoding
The code is as
This article mainly introduces common methods of PHPheader () functions and summarizes common usage. For more information, see // coding.
The code is as follows: header ('content-Type: text/html; charset = utf-8 ');
// Atom
The code is as
In php, the 301 redirection implementation method is very simple. we only need to simply use the header to send the 301 status code and then use the header to jump. The effect is the same as that of apache, iis, and nginx.
In php, the 301
Header()is used to send raw HTTPHeaders. See the http/1.1 specification for more information on HTTPHeaders.
Example One:
Copy CodeThe code is as follows:
Header ("location:http://www.jb51.net";);
exit;//must add "exit" after each redirect to
PHP header sets the common file type of Content-type,
In PHP, you can send header information through the header function, you can also set the file Content-type, the following collation of some common file types for the Content-type value.
Date 201
PHP uses the header method to download files,
First, we will introduce the PHP header () function.
Definition and usage
The header () function sends the original HTTP header to the client.
It is important to realize that the header () function must
Summary of common header definitions in PHP. Summary of definitions of common headers in PHP this article mainly introduces the definitions of common headers in PHP, which is very comprehensive and meticulous. For more information, see. He PHP
1PHP2 Header(' http/1.1-OK ');//OK normal Access3 Header(' http/1.1 404 Not Found ');//notifies the browser that the page does not exist4 Header(' http/1.1 301 Moved permanently ');//set the address to be permanently redirected 3015 Header('
This article mainly introduces PHP use header way to achieve file download function, very good, with reference value, the need for friends can refer to the next
Let me introduce you to the PHP header () function
Definition and usage
The header ()
First look at the definition of official documents(PHP 4, PHP 5, PHP 7)header- Sending native HTTP headers1 Header string $string $replace true $http _response_code ]] )Parameters: StringThere are two kinds of special heads. The first type of "http/
Header (' http/1.1 OK '); OK normal access
Header (' http/1.1 404 Not Found '); Notifies the browser that the page does not exist
Header (' http/1.1 301 Moved permanently '); Set the address to be permanently redirected 301
Header ('
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.