码迷,mamicode.com
首页 > 其他好文 > 详细

标头 header()函数的用法

时间:2014-09-09 11:41:28      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:http   io   ar   文件   html   on   c   时间   ad   

头 (header) 是服务器以 HTTP 协议传 HTML 资料到浏览器前所送出的字串,在标头与 HTML 文件之间尚需空一行分隔。

范例一: 本例使浏览器重定向到 PHP 的官方网站。

<?php

Header("Location: http://www.php.net");

exit;

?>

范例二:

<?php

/**

  @title:PHP定时跳转
       @功能:等待指定的时间,然后再跳转到指定页面(代替html meta方式)
    */
     header("refresh:3;url=http://axgle.za.net");

print(‘正在加载,请稍等...<br>三秒后自动跳转~~~‘);

/* 补充说明: 若等待时间为0,则与header("location:")等效。 */

?>

控制文件编码:header("Content-type: text/xml; charset=utf-8");

或者 header("Content-type:image/gif");

标头 header()函数的用法

标签:http   io   ar   文件   html   on   c   时间   ad   

原文地址:http://www.cnblogs.com/weekend001/p/3961841.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!