php - PayPal 的跟踪 ID

标签 php paypal paypal-ipn paypal-nvp

有时 PayPal 会中断,并且不会返回 tracking_id。同时在自己的服务器上完成支付。这对我来说是个问题,因为即使付款成功,我的服务器最终在数据库表中有一个空白的 tracking_id 列,这给我带来了很多问题

如果再次发生这种情况,下面的 if 语句是否足以捕获此类事件?

if( !isset($trackingId) || empty($trackingId) || $trackingId == null || $trackingId == "" ) {

    // something is wrong

} else {

    // continue as normal

}

最佳答案

使用empty .

Determine whether a variable is considered to be empty. A variable is considered empty if it does not exist or if its value equals FALSE. empty() does not generate a warning if the variable does not exist.

The following things are considered to be empty:

"" (an empty string) 
0 (0 as an integer)
0.0 (0 as a float) 
"0" (0 as a string) 
NULL 
FALSE 
array() (an empty array) 
$var; (a variable declared, but without a value)

关于php - PayPal 的跟踪 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18873598/

相关文章:

php - 需要 paypal 的简单 php SoapClient 示例

php - PayPal 托管页面和定期计费(附加 : Recurring Billing Suspension)

php - 在网页上显示来自 SSH 可访问文件的实时数据的最佳方式

php - Smarty 自动绑定(bind) PHP 变量到 Smarty 变量

Paypal 沙盒空白地址错误

paypal - 修改试用期或为现有的 Paypal 订阅添加第二个试用期

paypal - 如何管理 IPN url 和 notify_url

paypal - PalPAL 沙箱 IPN 处理器拒绝所有消息?

php - 为什么我不能从 WP_REST_Request 访问查询参数?

javascript - 在 JavaScript 中使用 $_SESSION ["attribute"]