初学php遇到的 $HTTP_RAW_POST_DATA 问题

whatmake 2016-04-26 09:58:46
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

我做小例子的时候报这种错误,网上都说是把always_populate_raw_post_data' 设置成 '-1',但是我去php.ini里面看了,默认的设置就是-1。哪位大神能够指点一下
...全文
26570 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
du56du 2017-06-04
  • 打赏
  • 举报
回复
引用 9 楼 fdipzone 的回复:
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0 表示$HTTP_RAW_POST_DATA 已经废弃了,所以应该使用file_get_contents('php://input');来获取
$GLOBALS['HTTP_RAW_POST_DATA']和$_POST能不能共存?我发现如果http请求的content-type字段不是application/x-www-form-urlencoded时$GLOBALS['HTTP_RAW_POST_DATA']变量就会存在,而此时$_POST变量不存在。这是不是说明$GLOBALS['HTTP_RAW_POST_DATA']和$_POST不能共存?或者说它们两个只能同时出现一个?
shubiliu 2017-03-05
  • 打赏
  • 举报
回复
记得重启PHP服务
shubiliu 2017-03-05
  • 打赏
  • 举报
回复
你看看php.in配置文件always_populate_raw_post_data前面的分号是不是没去掉,我也遇到这个问题了,而且是B-JUI前端引起的,更不好弄了,所以现在绕过了报错了
okSola 2017-02-27
  • 打赏
  • 举报
回复
引用 13 楼 visiontime 的回复:
这应该是个老问题了, 如果你是用phpstorm开发的 可能是settings--build,execution,deployment--deployment的设置没设置好. 是不是这个问题 检测很简单 wamp开启的时候 在浏览器输入你的本地项目访问地址看看是不是可以正常使用
是这个问题,但怎么解决呢?
MonKing__ 2017-02-08
  • 打赏
  • 举报
回复
这应该是个老问题了, 如果你是用phpstorm开发的 可能是settings--build,execution,deployment--deployment的设置没设置好. 是不是这个问题 检测很简单 wamp开启的时候 在浏览器输入你的本地项目访问地址看看是不是可以正常使用
skadk 2016-11-30
  • 打赏
  • 举报
回复
设原来是 $s = $HTTP_RAW_POST_DATA; 应写作 $s = file_get_contents('php://input'); 请问上面的是在哪修改???
faye1314 2016-08-03
  • 打赏
  • 举报
回复
引用 10 楼 whatmake 的回复:
应该是phpstorm破解版不能使用post方法
傻比,那是php环境的问题,phpstorm只是个编辑器,还和编辑器有关?
whatmake 2016-05-12
  • 打赏
  • 举报
回复
应该是phpstorm破解版不能使用post方法
傲雪星枫 2016-05-07
  • 打赏
  • 举报
回复
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0 表示$HTTP_RAW_POST_DATA 已经废弃了,所以应该使用file_get_contents('php://input');来获取
傲雪星枫 2016-05-07
  • 打赏
  • 举报
回复
$HTTP_RAW_POST_DATA 已经废弃了 应该用 file_get_contents('php://input');来获取
cwk44 2016-05-07
  • 打赏
  • 举报
回复
$GLOBALS['HTTP_RAW_POST_DATA']也一样 说不定一升级版本HTTP_RAW_POST_DATA读出来就空了 全局替换成file_get_contents('php://input') 就行了
whatmake 2016-05-06
  • 打赏
  • 举报
回复
并没有用到¥GTTP_RAW_POST_DATA...我只是用到了POST方法
码无边 2016-04-28
  • 打赏
  • 举报
回复
This feature has been DEPRECATED as of PHP 5.6.0. Relying on this feature is highly discouraged. $HTTP_RAW_POST_DATA 包含 POST 提交的原始数据。 一般而言,使用 php://input 代替 $HTTP_RAW_POST_DATA。
一起混吧 2016-04-26
  • 打赏
  • 举报
回复
$HTTP_RAW_POST_DATA 这个被废弃了,在将来的php版本中还会移除。 让你用 php://input 代替
xuzuning 2016-04-26
  • 打赏
  • 举报
回复
Deprecated 中文释义:过时的 显然你的 php 版本比较高 在高版本 php 的发版说明中都有 $HTTP_RAW_POST_DATA 即将(已经)取消,请改用从 php://input 中读取 的声明 设原来是 $s = $HTTP_RAW_POST_DATA; 应写作 $s = file_get_contents('php://input'); 多打几个字而已
智商众筹 2016-04-26
  • 打赏
  • 举报
回复
$GLOBALS['HTTP_RAW_POST_DATA'] 我是用这个写法

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧