doulao7572 2011-11-24 11:08 采纳率: 0%
浏览 66
已采纳

如何打印paypal返回数组

I am using Martin Maly's Paypal Library and everything works properly.The thing I could not manage to do is I get something like this in the returning page;

   Array
(
    [TOKEN] => EC-49D73912N5410881H
    [TIMESTAMP] => 2011-11-24T10:59:46Z
    [CORRELATIONID] => 328dc8f80aac
    [ACK] => Success
    [VERSION] => 52.0
    [BUILD] => 2271164
    [EMAIL] => hello_1321870042_per@blablabla.com
    [PAYERID] => QZNN94QVUSL88
    [PAYERSTATUS] => verified
    [FIRSTNAME] => Test
    [LASTNAME] => User
    [COUNTRYCODE] => FR
    [CUSTOM] => 20|EUR|
)

And I want all these data to be printed seperately such as;

echo $array['EMAIL'];

This is the first time I work with arrays and I have no idea how to deal with it? I would be very glad if anyone out here help me. Thanks.

  • 写回答

2条回答 默认 最新

  • douqiang5933 2011-11-24 11:13
    关注

    You can either do:

    print_r($array);
    

    or if you want it more readable:

    foreach ($array as $key => $value) {
        echo "$key: $value
    ";
    }
    

    or this if you want to output some array values but not others:

    $output_these_keys = array('FIRSTNAME', 'LASTNAME', 'CUSTOM');
    foreach ($array as $key => $value) {
        if (in_array($key, $output_these_keys)) echo "$key: $value
    ";
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 socket通信实现多人聊天室疑惑
  • ¥15 DEV-C++编译缺失
  • ¥33 找熟练码农写段Pyhthon程序
  • ¥100 怎么让数据库字段自动更新
  • ¥15 antv g6 力导向图布局
  • ¥15 quartz框架,No record found for selection of Trigger with key
  • ¥15 锅炉建模+优化算法,遗传算法优化锅炉燃烧模型,ls-svm会搞,后面的智能算法不会
  • ¥20 MATLAB多目标优化问题求解
  • ¥15 windows2003服务器按你VPN教程设置后,本地win10如何连接?
  • ¥15 求一阶微分方程的幂级数