php - Paypal 运输详细信息中的未定义索引

标签 php paypal sandbox

我从 paypal 送货详情中收到此错误消息

Notice: Undefined index: SALUTATION in /var/www/html/pp/temp/review.php on line 41

Notice: Undefined index: MIDDLENAME in /var/www/html/pp/temp/review.php on line 43

Notice: Undefined index: SUFFIX in /var/www/html/pp/temp/review.php on line 45

Notice: Undefined index: SHIPTOSTREET2 in /var/www/html/pp/temp/review.php on line 50

Notice: Undefined index: INVNUM in /var/www/html/pp/temp/review.php on line 56

Notice: Undefined index: PHONENUM in /var/www/html/pp/temp/review.php on line 57

我试过了

if( $ack == "SUCCESS" || $ack == "SUCESSWITHWARNING") 
    { 
          ///  echo '<pre>';print_r($resArray);exit;
        /*
        ' The information that is returned by the GetExpressCheckoutDetails call should be integrated by the partner into his Order Review 
        ' page      
        */
        $email              = $resArray["EMAIL"]; // ' Email address of payer.
        $payerId            = $resArray["PAYERID"]; // ' Unique PayPal customer account identification number.
        $payerStatus        = $resArray["PAYERSTATUS"]; // ' Status of payer. Character length and limitations: 10 single-byte alphabetic characters.
        $salutation         = $resArray["SALUTATION"]?$resArray["SALUTATION"]:''; // ' Payer's salutation.
        $firstName          = $resArray["FIRSTNAME"]; // ' Payer's first name.
        $middleName         = $resArray["MIDDLENAME"]?$resArray["MIDDLENAME"]:''; // ' Payer's middle name.
        $lastName           = $resArray["LASTNAME"]; // ' Payer's last name.
        $suffix             = $resArray["SUFFIX"]?$resArray["SUFFIX"]:''; // ' Payer's suffix.
        $cntryCode          = $resArray["COUNTRYCODE"]; // ' Payer's country of residence in the form of ISO standard 3166 two-character country codes.
        $business           = $resArray["BUSINESS"]; // ' Payer's business name.
        $shipToName         = $resArray["SHIPTONAME"]; // ' Person's name associated with this address.
        $shipToStreet       = $resArray["SHIPTOSTREET"]; // ' First street address.
        $shipToStreet2      = $resArray["SHIPTOSTREET2"]?$resArray["SHIPTOSTREET2"]:''; // ' Second street address.
        $shipToCity         = $resArray["SHIPTOCITY"]; // ' Name of city.
        $shipToState        = $resArray["SHIPTOSTATE"]; // ' State or province
        $shipToCntryCode    = $resArray["SHIPTOCOUNTRYCODE"]; // ' Country code. 
        $shipToZip          = $resArray["SHIPTOZIP"]; // ' U.S. Zip code or other country-specific postal code.
        $addressStatus      = $resArray["ADDRESSSTATUS"]; // ' Status of street address on file with PayPal   
        $invoiceNumber      = $resArray["INVNUM"]?$resArray["INVNUM"]:''; // ' Your own invoice or tracking number, as set by you in the element of the same name in SetExpressCheckout request .
        $phonNumber         = $resArray["PHONENUM"]?$resArray["PHONENUM"]:''; // ' Payer's contact telephone number. Note:  PayPal returns a contact telephone number only if your Merchant account profile settings require that the buyer enter one. 

    } 

但仍然是同样的问题。我该如何解决这个问题?请帮助我

最佳答案

use isset() 函数用于检查一个变量是否被设置。 替换

$salutation         = $resArray["SALUTATION"]?$resArray["SALUTATION"]:''; 

 $salutation = $resArray["SALUTATION"] ?? "default"; (for php 7)
$var = isset($resArray["SALUTATION"]) ? $resArray["SALUTATION"] : "default"; (before php 7)

都一样。

关于php - Paypal 运输详细信息中的未定义索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43114695/

相关文章:

php - 从数据库 PHP 进行 Base64 剪切图像

paypal - 我应该使用哪个 PayPal API 向关联公司发送付款

memory - Tomcat 沙箱网络应用程序吗?

php - 可选参数不是真正可选的

php - 我不需要 tcpdf 库

Paypal Adaptive - 三种支付方式

Instagram订阅

HTML5 iframe 沙箱属性问题

javascript - JSON 将数据从 HTML 发送到 PHP 并提醒用户该过程是否成功

android - Paypal 集成到 Android 应用程序