0

paypal 的 PHP5.2 的 IPN 示例代码中,在最后几行中,他们得到了“日志以供手动调查”的注释。

else if (strcmp ($res, "INVALID") == 0) {
    // log for manual investigation
}

我应该记录什么样的信息以及如何记录?

4

1 回答 1

0

好吧,您必须通过 $_POST 变量记录您从贝宝获得的答案。

如果您使用框架或 CMS,它可能具有日志记录功能。否则你可以使用 PHP 的error_log函数

例如:

$post_vars = var_export($_POST, true);
error_log("IPN Result: " . $res, 3, "/var/tmp/ipn.log");
error_log("POST_VARS: " . $post_vars, 3, "/var/tmp/ipn.log");

其中 /var/tmp/ipn.log 是您的日志文件应该出现的自定义路径。

于 2012-11-09T08:34:08.317 回答