php中出现Notice: Undefined index: HTTP_RAW_POST_DATA in D:Program Files解决思路

WBOY
Release: 2016-06-13 12:08:46
Original
1385 people have browsed it

php中出现Notice: Undefined index: HTTP_RAW_POST_DATA in D:\Program Files
我在php中写下了:

$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
运行后
php中出现Notice: Undefined index: HTTP_RAW_POST_DATA in D:\Program Files\phpEnv\phpdemo\shm_php01\shm01.php on line 47

然后我把php.ini文件中的always_populate_raw_post_data = On     注释去掉了

; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is
; to disable this feature. If post reading is disabled through
; enable_post_data_reading, $HTTP_RAW_POST_DATA is *NOT* populated.
; http://php.net/always-populate-raw-post-data
always_populate_raw_post_data = On     

重启依然不能用,求高人指点迷津
------解决思路----------------------
always_populate_raw_post_data = On

当以 post 方式提交时,可用 
echo $HTTP_RAW_POST_DATA;
打印出提交过来的无格式串

当然不是 post 方式提交时,就是未定义
------解决思路----------------------
其实这本可以用 file_get_contents('php://input') 代替的
------解决思路----------------------
直接运行,当然是直接返回
要是 post 提交的才行
------解决思路----------------------
测试时,你得写个表单

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!