ls0398 发表于 2018-12-19 14:05:55

PHP header函数设置http报文头示例详解

//定义编码header( 'Content-Type:text/html; ');  
//Atomheader('Content-type: application/atom+xml');
  
//CSSheader('Content-type: text/css');
  
//Javascriptheader('Content-type: text/javascript');
  
//JPEG Imageheader('Content-type: image/jpeg');
  
//JSONheader('Content-type: application/json');
  
//PDFheader('Content-type: application/pdf');
  
//RSSheader('Content-Type: application/rss+xml; charset=ISO-8859-1');
  
//Text (Plain)header('Content-type: text/plain');
  
//XMLheader('Content-type: text/xml');
  
//200 OKheader('HTTP/1.1 200 OK');
  
//设置一个404头:header('HTTP/1.1 404 Not Found');
  
//设置地址被永久的重定向header('HTTP/1.1 301 Moved Permanently');
  
//转到一个新地址header('Location: http://www.example.org/');
  
//文件延迟转向:header('Refresh: 10; url=http://www.example.org/');print 'You will be redirected in 10 seconds';
  
//当然,也可以使用html语法实现//
页: [1]
查看完整版本: PHP header函数设置http报文头示例详解