我正在使用Bit2Check.com API。我想查看在PayPal上注册的电子邮件。但在向API提供电子邮件地址后,我收到了此回复:
{"Paypal":"Linked"}
我只想抓住“链接”部分。
答案 0 :(得分:0)
您没有向我提供任何代码,因此我将不得不尝试回答您的问题。
你可能有{"Paypal" : "Linked"}
存储在某个变量中。要访问“已关联”部分,您需要json_decode()
它。只检索“链接”字符串的代码就像这样。
$yourVariable = '{"Paypal" : "Linked"}';
$decoded = json_decode($yourVariable);
// Access only linked part
$onlyLinked = $decoded->Paypal;
// Or maybe you are interested in boolean value?
$isLinked = ($decoded->Paypal == "Linked") ? true : false;
要了解有关json_decode()的更多信息,请访问php.net上的this article。