php - WeChat Pay cannot receive the XML data of successful payment sent from the WeChat server?
我想大声告诉你
我想大声告诉你 2017-05-16 13:06:38
0
4
800

Downloaded the official DEMO of WeChat Pay and paid using Mode 2. There is no problem with the payment now and the payment can be successful. However, the XML data sent by WeChat cannot be received in the callback notify.php;

The notify.php code is as follows:

$input = $GLOBALS['HTTP_RAW_POST_DATA'];
$xml = simplexml_load_string($input, 'SimpleXMLElement', LIBXML_NOCDATA);
var_dump($xml);

The WeChat official account payment authorization directory is as follows:

我想大声告诉你
我想大声告诉你

reply all(4)
世界只因有你

If yesPHP7Use the following method to obtain the WeChat asynchronous notification parameters


file_get_contents("php://input");

PHPzhong

$GLOBALS['HTTP_RAW_POST_DATA']; It seems that the entire function has been deleted in php7, use file_get_contents('php://input')

滿天的星座

1. First check the log in nginx or apache to check whether the WeChat client requested a callback connection after the payment was successful.
2. If a link is requested, check the function logic issues in the callback

曾经蜡笔没有小新

Higher versions of PHP are not availableHTTP_RAW_POST_DATA
Please use them consistently

file_get_contents('php://input');
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template