【江苏福彩快三】header函数使用教程,header函数

作者:江苏福彩快三计算机网络

复制代码 代码如下:

在php语言中,header()那几个函数很有用的,尤其在采取ajax时候,他会帮您消除一部分意外的问题。上面是header的片段详细批注。希望对phper有救助

二个完美的示范PHP header()函数用法的欧洲经济共同体代码。

在php语言中,header()那几个函数很有用的,特别在动用ajax时候,他会帮你消除一部分匪夷所思的标题。上面是header的部分详实疏解。希望对phper有援救

在php语言中,header()那么些函数很有用的,非常在行使ajax时。

<?php
// fix 404 pages:
header('HTTP/1.1 200 OK');
// set 404 header:
header('HTTP/1.1 404 Not Found');
// set Moved Permanently header (good for redrictions)
// use with location header
header('HTTP/1.1 301 Moved Permanently');
// redirect to a new location:
header('Location: ');
// redrict with delay:
header('Refresh: 10; url=');
print 'You will be redirected in 10 seconds';
// you could also use the HTML syntax:// <meta http-equiv="refresh" content="10; />
// override X-Powered-By: PHP:
header('X-Powered-By: PHP/4.4.0');
header('X-Powered-By: Brain/0.6b');
// content language (en = English)
header('Content-language: en');
// last modified (good for caching)
$time = time() – 60; // or filemtime($fn), etc
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');
// header for telling the browser that the content
// did not get changed
header('HTTP/1.1 304 Not Modified');
// set content length (good for caching):
header('Content-Length: 1234');
// Headers for an download:
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.zip"');
header('Content-Transfer-Encoding: binary');
// load the file to send:readfile('example.zip');
// Disable caching of the current document:
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Date in the pastheader('Pragma: no-cache');
// set content type:
header('Content-Type: text/html; charset=iso-8859-1');
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: text/plain');
// plain text file
header('Content-Type: image/jpeg');
// JPG picture
header('Content-Type: application/zip');
// ZIP file
header('Content-Type: application/pdf');
// PDF file
header('Content-Type: audio/mpeg');
// Audio MPEG (MP3,…) file
header('Content-Type: application/x-shockwave-flash');
// Flash animation// show sign in box
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Top Secret"');
print 'Text that will be displayed if the user hits cancel or ';
print 'enters wrong login data';
?>

复制代码 代码如下:

个中介绍的refresh方法,比<META ……用起来更百发百中,应该是段不错的代码。

代码如下:

下边是header的一些详细批注。  

你大概感兴趣的稿子:

  • PHP下利用header()函数设置浏览器缓存的代码
  • PHP中Header使用的HTTP协议及常用方法小结
  • PHP利用header跳转失效的消除措施
  • php输出xml必须header的解决方法
  • PHP header()函数常用方法总括
  • php用header函数实现301跳转代码实例
  • Php header()函数语法及采用代码
  • php header效能的运用
  • 研讨php中header的用法详解
  • PHP使用header()输出图片缓存实例

<?php
// fix 404 pages:
header('HTTP/1.1 200 OK');
// set 404 header:
header('HTTP/1.1 404 Not Found');
// set Moved Permanently header (good for redrictions)
// use with location header
header('HTTP/1.1 301 Moved Permanently');
// redirect to a new location:
header('Location: ');
// redrict with delay:
header('Refresh: 10; url=');
print 'You will be redirected in 10 seconds';
// you could also use the HTML syntax:// <meta http-equiv="refresh" content="10; />
// override X-Powered-By: PHP:
header('X-Powered-By: PHP/4.4.0');
header('X-Powered-By: Brain/0.6b');
// content language (en = English)
header('Content-language: en');
// last modified (good for caching)
$time = time() – 60; // or filemtime($fn), etc
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');
// header for telling the browser that the content
// did not get changed
header('HTTP/1.1 304 Not Modified');
// set content length (good for caching):
header('Content-Length: 1234');
// Headers for an download:
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.zip"');
header('Content-Transfer-Encoding: binary');
// load the file to send:readfile('example.zip');
// Disable caching of the current document:
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Date in the pastheader('Pragma: no-cache');
// set content type:
header('Content-Type: text/html; charset=iso-8859-1');
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: text/plain');
// plain text file
header('Content-Type: image/jpeg');
// JPG picture
header('Content-Type: application/zip');
// ZIP file
header('Content-Type: application/pdf');
// PDF file
header('Content-Type: audio/mpeg');
// Audio MPEG (MP3,…) file
header('Content-Type: application/x-shockwave-flash');
// Flash animation// show sign in box
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Top Secret"');
print 'Text that will be displayed if the user hits cancel or ';
print 'enters wrong login data';
?>

<?php 
/*** Function: PHP header() examples (PHP) 
** Desc: Some examples on how to use the header() function of PHPYou find a detailed tutorial at expertsrt.com (English) or at ffm.junetz.de (German).These is also a good help about caching at web-caching.com. 
** Example: see below. <br/><br/><b>Tip:</b> You can use these sites to check your headers: <a href=";, <a href="; or <a href=";. 
** Author: Jonas John 
*/ 

<?php
// fix 404 pages:
header('HTTP/1.1 200 OK');
// set 404 header:
header('HTTP/1.1 404 Not Found');
// set Moved Permanently header (good for redrictions)
// use with location header
header('HTTP/1.1 301 Moved Permanently');
// redirect to a new location:
header('Location: ');
// redrict with delay:
header('Refresh: 10; url=');
print 'You will be redirected in 10 seconds';
// you could also use the HTML syntax:// <meta http-equiv="refresh" content="10; />
// override X-Powered-By: PHP:
header('X-Powered-By: PHP/4.4.0');
header('X-Powered-By: Brain/0.6b');
// content language (en = English)
header('Content-language: en');
// last modified (good for caching)
$time = time() – 60; // or filemtime($fn), etc
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');
// header for telling the browser that the content
// did not get changed
header('HTTP/1.1 304 Not Modified');
// set content length (good for caching):
header('Content-Length: 1234');
// Headers for an download:
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.zip"');
header('Content-Transfer-Encoding: binary');
// load the file to send:readfile('example.zip');
// Disable caching of the current document:
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Date in the pastheader('Pragma: no-cache');
// set content type:
header('Content-Type: text/html; charset=iso-8859-1');
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: text/plain');
// plain text file
header('Content-Type: image/jpeg');
// JPG picture
header('Content-Type: application/zip');
// ZIP file
header('Content-Type: application/pdf');
// PDF file
header('Content-Type: audio/mpeg');
// Audio MPEG (MP3,…) file
header('Content-Type: application/x-shockwave-flash');
// Flash animation// show sign in box
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Top Secret"');
print 'Text that will be displayed if the user hits cancel or ';
print 'enters wrong login data';
?>

 1 <?php

您大概感兴趣的小说:

  • 追究php中header的用法详解
  • php 模拟get_headers函数的代码示例
  • php header示例代码(推荐)
  • php header 详细使用表明与使用体验
  • 分享PHP header函数使用教程

// fix 404 pages: 
header('HTTP/1.1 200 OK'); 

2 /**

// set 404 header: 
header('HTTP/1.1 404 Not Found'); 

 3 * php header函数用法举个例子
 4 * 整理:www.jbxue.com
 5 */
 6 // fix 404 pages: 
 7 header('HTTP/1.1 200 OK'); 
 8 // set 404 header: 
 9 header('HTTP/1.1 404 Not Found'); 
10 // set Moved Permanently header (good for redrictions) 
11 // use with location header 
12 header('HTTP/1.1 301 Moved Permanently'); 
13 // redirect to a new location: 
14 header('Location: '); 
15 // redrict with delay: 
16 header('Refresh: 10; url='); 
17 print 'You will be redirected in 10 seconds'; 
18 // you could also use the HTML syntax:// <meta http-equiv="refresh" content="10; /> 
19 // override X-Powered-By: PHP: 
20 header('X-Powered-By: PHP/4.4.0'); 
21 header('X-Powered-By: Brain/0.6b'); 
22 // content language (en = English) 
23 header('Content-language: en'); 
24 // last modified (good for caching) 
25 $time = time() – 60; // or filemtime($fn), etc 
26 header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); 
27 // header for telling the browser that the content 
28 // did not get changed 
29 header('HTTP/1.1 304 Not Modified'); 
30 // set content length (good for caching): 
31 header('Content-Length: 1234'); 
32 // Headers for an download: 
33 header('Content-Type: application/octet-stream'); 
34 header('Content-Disposition: attachment; filename="example.zip"'); 
35 header('Content-Transfer-Encoding: binary'); 
36 // load the file to send:readfile('example.zip'); 
37 // Disable caching of the current document: 
38 header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); 
39 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 
40 // Date in the pastheader('Pragma: no-cache'); 
41 // set content type: 
42 header('Content-Type: text/html; charset=iso-8859-1'); 
43 header('Content-Type: text/html; charset=utf-8'); 
44 header('Content-Type: text/plain'); 
45 // plain text file 
46 header('Content-Type: image/jpeg'); 
47 // JPG picture 
48 header('Content-Type: application/zip'); 
49 // ZIP file 
50 header('Content-Type: application/pdf'); 
51 // PDF file 
52 header('Content-Type: audio/mpeg'); 
53 // Audio MPEG (MP3,…) file 
54 header('Content-Type: application/x-shockwave-flash'); 
55 // Flash animation// show sign in box 
56 header('HTTP/1.1 401 Unauthorized'); 
57 header('WWW-Authenticate: Basic realm="Top Secret"'); 
58 print 'Text that will be displayed if the user hits cancel or '; 
59 print 'enters wrong login data'; 
60 ?>

本文由江苏福彩快三发布,转载请注明来源

关键词: 江苏福彩快三