如何打印 paypal 返回数组
我正在使用 Martin Maly 的 Paypal Library,一切正常。我无法做到的是我在返回页面中得到类似的内容;
Array
(
[TOKEN] => EC-49D73912N5410881H
[TIMESTAMP] => 2011-11-24T10:59:46Z
[CORRELATIONID] => 328dc8f80aac
[ACK] => Success
[VERSION] => 52.0
[BUILD] => 2271164
[EMAIL] => [email protected]
[PAYERID] => QZNN94QVUSL88
[PAYERSTATUS] => verified
[FIRSTNAME] => Test
[LASTNAME] => User
[COUNTRYCODE] => FR
[CUSTOM] => 20|EUR|
)
我希望所有这些数据都单独打印,例如;
echo $array['EMAIL'];
这是我第一次使用数组,我不知道如何处理它? 如果这里有人帮助我,我会非常高兴。 谢谢。
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] => [email protected]
[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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以这样做:
或者如果您希望它更具可读性:
或者如果您想输出一些数组值但不输出其他值,则可以这样做:
You can either do:
or if you want it more readable:
or this if you want to output some array values but not others:
您想分别访问和打印数组键和数组值吗?给你:
此外,如果您想删除键并使用从 0 开始的索引数组(即能够使用索引访问数组),请使用 array_values($array); ,这将返回索引数组
并且不要害怕真正有用的官方文档。
Do you want to access and print array keys and array values separately? Here you go:
Also, if you want to drop the keys and instead have indexed array starting from 0 (that is, being able to access array with indexes), use
array_values($array);
which will return indexed arrayAnd don't be afraid of really helpful official documentation.