我遇到BlockChain API响应问题。从钱包中获取地址时,地址用双引号括起来,如下所示。如何剥离报价?
“1Dgyv8Qz1nkrJddoyLBepv1RUXSDqCBCdp”
代码:
$resp = file_get_contents($blockchain_receive_root . "v2/receive?key=" . $my_api_key . "&gap_limit=".$gap_limit. "&callback=" . urlencode($callback_url) . "&xpub=" . $my_xpub);
$response = json_decode($resp);
print json_encode($response->address);
答案 0 :(得分:0)
你不需要删除任何东西。当您在添加双引号的字符串上调用json_encode
时会出现此问题。
所以只需删除json_encode
来电,就应该像魅力一样:
$resp = file_get_contents($blockchain_receive_root . "v2/receive?key=" . $my_api_key . "&gap_limit=".$gap_limit. "&callback=" . urlencode($callback_url) . "&xpub=" . $my_xpub);
$response = json_decode($resp);
print $response->address;