php headerº¯ÊýµÄ³£ÓÃhttpÍ·ÉèÖÃ

5年以前  |  阅读数:351 次  |  编程语言:PHP 

    //ok
    header(¡®HTTP/1.1 200 OK');
    //ÉeÖÃÒ»¸o404Í*:
    header(¡®HTTP/1.1 404 Not Found');
    //ÉeÖõØÖ*±»ÓÀ¾ÃµÄÖض¨Ïo
    header(¡®HTTP/1.1 301 Moved Permanently');
    //תµ½Ò»¸oеØÖ*
    header(¡®Location: http://www.example.org/¡®);
    //ÎļþÑÓ³ÙתÏo:
    header(¡®Refresh: 10; url=http://www.example.org/¡®);
    print ¡®You will be redirected in 10 seconds';
    //µ±È»£¬Ò²¿ÉÒÔʹÓÃhtmlÓi*¨ÊµÏÖ
    // <meta http-equiv=¡±refresh¡± content=¡±10;http://www.example.org/ />
    // override X-Powered-By: PHP:
    header(¡®X-Powered-By: PHP/4.4.0¡a);
    header(¡®X-Powered-By: Brain/0.6b');
    //ÎĵµÓiÑÔ
    header(¡®Content-language: en');
    //¸aeËßa¯ÀÀÆ÷×iºoÒ»´ÎÐÞ¸Äʱ¼a
    $time = time() ¨C 60; // or filemtime($fn), etc
    header(¡®Last-Modified: ¡®.gmdate(¡®D, d M Y H:i:s', $time).' GMT');
    //¸aeËßa¯ÀÀÆ÷ÎĵµÄÚÈÝûÓÐ*¢Éu¸Ä±a
    header(¡®HTTP/1.1 304 Not Modified');
    //ÉeÖÃÄÚÈݳ¤¶È
    header(¡®Content-Length: 1234¡a);
    //ÉeÖÃΪһ¸oÏÂÔØÀaÐÍ
    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');
    // ¶Ôµ±Ç°Îĵµ½uÓûº´ae
    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 past
    header(¡®Pragma: no-cache');
    //ÉeÖÃÄÚÈÝÀaÐÍ:
    header(¡®Content-Type: text/html; charset=iso-8859-1¡a);
    header(¡®Content-Type: text/html; charset=utf-8¡a);
    header(¡®Content-Type: text/plain'); //´¿Îı¾¸ñʽ
    header(¡®Content-Type: image/jpeg'); //JPG***
    header(¡®Content-Type: application/zip'); // ZIPÎļþ
    header(¡®Content-Type: application/pdf'); // PDFÎļþ
    header(¡®Content-Type: audio/mpeg'); // ÒoƵÎļþ
    header(¡®Content-Type: application/x-shockw**e-flash'); //Flash¶¯»­
    //ÏÔʾµÇ½¶Ô»°¿o
    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分页显示制作详细讲解
SSH 登录失败:Host key verification failed
获取IMSI
将二进制数据转为16进制以便显示
获取IMEI
文件下载
贪吃蛇
双位运算符
PHP自定义函数获取搜索引擎来源关键字的方法
Java生成UUID
发送邮件
年的日历图
提取后缀名
在Zeus Web Server中安装PHP语言支持
让你成为最历害的git提交人
Yii2汉字转拼音类的实例代码
再谈PHP中单双引号的区别详解
指定应用ID以获取对应的应用名称
Python 2与Python 3版本和编码的对比
php封装的page分页类完整实例