PHP は header 関数を使用して HTTP ヘッダーのサンプル分析テーブルを設定します header_PHP チュートリアル

WBOY
リリース: 2016-07-21 15:05:43
オリジナル
817 人が閲覧しました

以下に示すように:

コードをコピーします コードは次のとおりです:

//エンコーディングを定義します
header( 'Content-Type: text/html;charset=utf-8 ');
//Atom
header('Content-type: application/atom+xml');

//CSS
header('Content-type: text/css'); header('Content-type: text/javascript');

//JPEG 画像
header('Content-type: image/jpeg');

//JSON
header('Content-type: application/json' );

//PDF
header('Content-type: application/pdf');

//RSS
header('Content-Type: application/rss+xml; charset= ISO-8859- 1');
//テキスト (プレーン)

header('コンテンツ タイプ: text/plain')
//XML

header('コンテンツ タイプ: text/xml ');
// ok

header('HTTP/1.1 200 OK')
// 404 ヘッダーを設定します:

/ /アドレスを永続的なリダイレクトに設定します
header('HTTP/1.1 301 Moved Permanently')

//新しいアドレスに移動します
header('場所: http://www.example.org/' );

//ファイルのリダイレクトが遅延しました:
header('Refresh: 10; url=http://www.example.org/');

10 秒後にリダイレクトされます。 // もちろん、HTML 構文を使用して実装することもできます
// // 送信するファイルをロードします:
readfile('example.zip');

// 現在のドキュメントのキャッシュを無効にする

header('Cache-Control: no-cache、no-store、max-age=0、must-revalidate'); header('Expires: Mon, 26 Jul 1997 05 :00:00 GMT'); // 過去の日付
header('Pragma: no-cache'); // コンテンツ タイプを設定します: header( 'Content-Type: text/html; charset= iso-8859-1');
header('Content-Type: text/html; charset=utf-8'); '); //プレーンテキスト形式
header( 'Content-Type: image/jpeg'); //JPG***
header('Content-Type: application/zip'); // ZIP ファイル
header(' Content-Type: application/pdf'); // PDF ファイル
header('Content-Type: audio/mpeg') // 音声ファイル
header('Content-Type: application/x-shockw**e-flash) '); // Flashアニメーション
/ /ログインダイアログを表示
header('HTTP/1.1 401 Unauthorized')
print 'Textユーザーが「キャンセル」または「
print」を押した場合に表示されます。「間違ったログインデータを入力しました」


http://www.bkjia.com/PHPjc/327669.html

www.bkjia.com

tru​​e

http://www.bkjia.com/PHPjc/327669.html

技術記事

以下に示すように、次のようにコードをコピーします。 //Definecoding header('Content-Type:text/html;charset=utf-8 ') //Atom header('Content-type: application/atom+xml'); ; //CSS ヘッダー('コンテンツ...



ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!