首页 > 技术文章 > Warning: Cannot modify header information - headers already sent in Unknown on line 0

haokan 2020-03-15 08:42 原文

运行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

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

 

解决方法:

php.ini文件下:开启always_populate_raw_post_data = -1 之后保存重启即可

原因:开启后就可以用 $HTTP_RAW_POST_DATA 接收data,不过通常我们使用 php://input

推荐阅读