php - 在 php 7 中用什么替换 $GLOBALS ['HTTP_RAW_POST_DATA' ]?

标签 php php-7

$HTTP_RAW_POST_DATA 在 PHP 7.0 中被移除。在我的应用程序中,我还有以下行。我可以为此使用什么替代方案?

if (isset($GLOBALS['HTTP_RAW_POST_DATA']) && 
                                  mb_strlen($GLOBALS['HTTP_RAW_POST_DATA']))

最佳答案

根据manual :

In general, php://input should be used instead of $HTTP_RAW_POST_DATA



要获取原始帖子数据:
<?php $postdata = file_get_contents("php://input"); ?>

关于php - 在 php 7 中用什么替换 $GLOBALS ['HTTP_RAW_POST_DATA' ]?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55370961/

相关文章:

php - MySQL 查询 - 替代方案

php - 在 Laravel 5.1 上在 Controller 的构造函数之前运行中间件?

soap - 使用soap的段错误php7 symfony cli命令

PHP 7 RC3 : How to install missing MySQL PDO

Windows 上带有 pthreads 3.1.5 的 PHP 7.0.0 无法启动

php - "Array keys must be CURLOPT constants or equivalent integer values"在 PHP 7 中使用curl_setopt_array()

php - 根据宽度计算横幅的高度

php - Where Like 语句选择具有特定标签的记录

php - 来自 PHP/MYSQL 查询的唯一/不同值

php - 在检查 bool 值的情况下,php 7 中的 <=> 如何响应?