php中header()

浏览器访问http服务器,接收到响应时,会根据响应报文头的内容进行一些具体的操作,在php中,我们能够使用 header来设置这些内容

  • 设置文本编码

    • 设置编码格式为:utf-8

      header('content-type:text/html; charset= utf-8');
      
  • 设置页面跳转

    • 设置跳转到百度首页
header('location:http://www.baidu.com');
  • 设置页面间隔刷新

    header('refresh:3; url=http://www.xiaomi.com');
    

results matching ""

    No results matching ""