Home >Backend Development >PHP Tutorial >php Request request json data packet is escaped

php Request request json data packet is escaped

WBOY
WBOYOriginal
2016-09-23 11:31:072113browse

POST request interface, send data packet as shown below

php Request request json data packet is escaped

Header is as shown below

php Request request json data packet is escaped

Then when I interfaced $request = file_get_contents("php://input"); and var_dump($request), the printed content was as shown in the Body in Figure 1. At first, I thought it was due to environmental reasons. , php://input needs to set always_populate_raw_post_data = -1 in php.ini.

In the end, the printed content is still the same. What I expected was to print out
php Request request json data packet is escaped

I hope someone can give me some advice to solve this problem.

Reply content:

POST request interface, send data packet as shown below

php Request request json data packet is escaped

Header is as shown below

php Request request json data packet is escaped

Then when I interfaced $request = file_get_contents("php://input"); and var_dump($request), the printed content was as shown in the Body in Figure 1. At first, I thought it was due to environmental reasons. , php://input needs to set always_populate_raw_post_data = -1 in php.ini.

In the end, the printed content is still the same. What I expected was to print out
php Request request json data packet is escaped

I hope someone can give me some advice to solve this problem.

Young man, you have enabled the xdebug module, so the output will have a beautifying effect. What you see is the html tag plus the escape code.

  • Uninstall this module

or

  • Turn off the html_errors option in php.ini

Is the var_dump method rewritten? I see that your return body has some extra tags, and the data is correct.

You turned on xdebug

Statement:
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