欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP之header函數(shù)詳解

 更新時間:2021年03月02日 15:24:45   作者:PHP開發(fā)學(xué)習(xí)門戶  
這篇文章主要介紹了PHP之header函數(shù)詳解,小編覺得這個header函數(shù)的技術(shù)點還是比較重要的,感興趣的同學(xué)可以研究下

PHP的header函數(shù)是最常用的函數(shù)之一,用于向客戶端發(fā)送HTTP頭信息。

通過的用法如設(shè)置編碼、發(fā)送HTTP狀態(tài)值以及重定向。

php header utf8 :

header(“Content-type: text/html; charset=utf-8″);

php header 404 :

header(“HTTP/1.0 404 Not Found”);

上述兩個例子分別是設(shè)置UTF8編碼和發(fā)送404狀態(tài)。

header重定向:

header(‘Location: http://www.phpthinking.com');

其他常用的Header用法:

// Header永久性重定向,一般301與header Location一起使用.

header(‘HTTP/1.1 301 Moved Permanently');
header(‘Location: http://www.phpthinking.com/');

// Header延時刷新頁面

//與HTML頁面中的<meta http-equiv=”refresh” content=”10;http://www.phpthinking.com” />效果一樣
header(‘Refresh: 10; url=http://www.phpthinking.com/');

// Header設(shè)置頁面語言

header(‘Content-language: en');

// 對于下載頁面,可以聲明文件類型和文件名

header(‘Content-Type: application/octet-stream');
header(‘Content-Disposition: attachment; filename=”filename.zip”‘);
header(‘Content-Transfer-Encoding: binary');

// Header設(shè)置緩存和緩存過期時間

header(‘Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header(‘Expires: Mon, 26 Jul 1997 05:00:00 GMT');

// Header設(shè)置頁面編碼:

header(‘Content-Type: text/html; charset=utf-8′);

到此這篇關(guān)于PHP之header函數(shù)詳解的文章就介紹到這了,更多相關(guān)PHP之header函數(shù)內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論