PayPal 的 PHP IPN 侦听器示例代码在顶部有以下注释/代码:
// reading posted data from directly from $_POST causes serialization
// issues with array data in POST
// reading raw POST data from input stream instead.
$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
$keyval = explode ('=', $keyval);
if (count($keyval) == 2)
$myPost[$keyval[0]] = urldecode($keyval[1]);
}
有人可以解释此评论所指的序列化问题吗?虽然我可以这样做,但如果知道为什么要这样做,我会感到更自在。