我有下面的数组与键组合*我想使用数组键
获取值我得到了api的答复
Array (
[pos] => Bitpay\Token Object
(
[token:protected] => 8Q13oFMiBLBcqFCK5wWfhUYxxhcpkq4C6Xqh6ipgbxTm
[resource:protected] =>
[facade:protected] => pos
[createdAt:protected] =>
[policies:protected] => Array
(
)
[pairingCode:protected] =>
[pairingExpiration:protected] =>
)
[pos/invoice] => Bitpay\Token Object
(
[token:protected] => 4XyeM78xv6ywzTB3Cc2yak7Bb9duAW1DaCu5XDAVuSEQ
[resource:protected] =>
[facade:protected] => pos/invoice
[createdAt:protected] =>
[policies:protected] => Array
(
)
[pairingCode:protected] =>
[pairingExpiration:protected] =>
)
)
我转换数组后我得到了数组结构,我想得到一个令牌:受保护的值,我怎么能得到这个
Array(
[*token] => 8Q13oFMiBLBcqFCK5wWfhUYxxhcpkq4C6Xqh6ipgbxTm
[*resource] =>
[*facade] => pos
[*createdAt] =>
[*policies] => Array
(
)
[*pairingCode] =>
[*pairingExpiration] =>
)
我想获取一个令牌值,任何一个请帮助。
答案 0 :(得分:0)
使用引号应该可以实现:
<?php
$myArray = array(
'*token' => '8Q13oFMiBLBcqFCK5wWfhUYxxhcpkq4C6Xqh6ipgbxTm',
'*resource' => '',
'*facade' => 'pos',
'*createdAt' => '',
'*policies' => array
(
),
'*pairingCode' => '',
'*pairingExpiration' => '',
);
print $myArray['*token'];
?>