php5.6版本出现Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated…

使用php版本5.6出现了以下提示和警告。

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

Warning: Cannot modify header information - headers already sent in Unknown on line 0

查看官方手册,$HTTP_RAW_POST_DATA 包含 POST 提交的原始数据。这个功能强烈不建议在PHP5.6版本中使用,将会在7.0版本删除该函数,可以 php://input代替。

Warning This feature was DEPRECATED in PHP 5.6.0, and REMOVED as of PHP 7.0.0. 一般而言,使用 php://input 代替 $HTTP_RAW_POST_DATA

PHP5.6版本如果需要屏蔽这个提示,可以修改php.ini配置。

always_populate_raw_post_data = -1