首页 > php > faq > 8.php $HTTP_RAW_POST_DATA is deprecated

8.php $HTTP_RAW_POST_DATA is deprecated

在使用php5.6接收http post请求的数据,解析post数据中json字符串时。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 0Warning: Cannot modify header information - headers already sent in Unknown on line 0 No input file specified. "

1 解决$HTTPRAWPOST_DATA is deprecated

修改php.ini中的alwayspopulaterawpostdata值设为-1.这一行默认是注释的。打开注释即可。

always_populate_raw_post_data = -1

然后重启php服务.

转载请保留原文链接.