302  临时重定向

header("location:http://api.com/headline?" . http_build_query($_REQUEST));

301  永久重定向     (  302 和 301  的区别主要在于搜索引擎,搜索引擎一般不会抓取临时重定向的页面  )

header('HTTP/1.1 301 Moved Permanently');
header("location:http://imcpapi.com/headline?" . http_build_query($_REQUEST));

301 和302 适用于 普通的GET 请求;

如果是 带数据的POST 请求,采用 以上两者都会丢失请求数据,比如:post  请求 a.php

a.php 代码:

header(" Location:b.php ",true,301);

会造成b.php里面获取不到 post的数据

要重定向post请求可以使用  307 ;

header("HTTP/1.1 307 Temporary Redirect");
header("Location: https://api.com/headline?" . http_build_query($_GET));

最新文章

  1. php : Warning: strftime(): It is not safe to rely on the system's timezone settings.
  2. GPU渲染和GDI
  3. PHP操作数据库类
  4. 分布式系统之CAP理论
  5. .NET连接SAP系统专题:.NET调用RFC几种方式(一)
  6. passenger nginx
  7. JS复习:第二十章
  8. 利用jink调试程序,时间不准的解决办法
  9. java_jstl 标签库
  10. 本地代码上传到git
  11. 提问:MicrosoftUnderlying input stream returned zero bytes
  12. Luogu 3793 由乃救爷爷
  13. and与or的用法
  14. RIP路由协议(一)
  15. BZOJ3738 [Ontak2013]Kapitał 【扩展Lucas】
  16. linux命令分享一:压缩命令
  17. e645. 处理键盘事件
  18. Xcode常用插件推荐
  19. php -- PDO事务处理
  20. Spring-1-A Post Robot(HDU 5007)解题报告及测试数据

热门文章

  1. ambari安装hadoop
  2. sparksql笔记
  3. 【网络】Vmware虚拟机下三种网络模式配置
  4. PHP curl_multi_strerror函数
  5. jdbc blob插入及查询操作
  6. 用 GetEnvironmentVariable 获取常用系统环境变量
  7. teradata在虚拟机安装客户端sql Assistant
  8. echarts(4.0版本)
  9. vue父组件与子组件之间的数据传递
  10. vue-cli3.0打包完自动压缩zip