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

微信接收推送事件消息时出现 且php版本5.6.31 iis7的服务器

原先代码接收微信推送消息用 $GLOBALS['HTTP_RAW_POST_DATA']

结果后台php日志报错 

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

 

Deprecated 中文释义:过时的
显然你的 php 版本比较高
在高版本 php 的发版说明中都有 $HTTP_RAW_POST_DATA 即将(已经)取消,请改用从 php://input 中读取 的声明

设原来是 $s = $HTTP_RAW_POST_DATA;
应写作 $s = file_get_contents('php://input');

 

$HTTP_RAW_POST_DATA 这个被废弃了,在将来的php版本中还会移除。
让你用 php://input 代替

其它备注:顺便看看 php.in配置文件always_populate_raw_post_data前面的分号是不是没去掉 always_populate_raw_post_data = -1

记得重启PHP服务

posted @ 2017-09-05 10:45  加菲猫and大白  阅读(770)  评论(0编辑  收藏  举报