如何从 jsonp php 获取单个值
How can I get a single value from jsonp php
任何人都可以帮助我,我已经完成了一个 API 调用,我需要从响应中获取一个值,因为响应带有 jsonp。
jsonp ({"statuscode":"025","RRR":"290007816182","status":"Payment Reference generated"})"
您应该在变量中获得响应并使用 json_decode 函数,如下所示:
$response = '{"statuscode":"025","RRR":"290007816182","status":"Payment Reference generated"}';
$result = json_decode($response);
echo $result->statuscode;
echo "<br>";
echo $result->RRR;
echo "<br>";
echo $result->status;
任何人都可以帮助我,我已经完成了一个 API 调用,我需要从响应中获取一个值,因为响应带有 jsonp。
jsonp ({"statuscode":"025","RRR":"290007816182","status":"Payment Reference generated"})"
您应该在变量中获得响应并使用 json_decode 函数,如下所示:
$response = '{"statuscode":"025","RRR":"290007816182","status":"Payment Reference generated"}';
$result = json_decode($response);
echo $result->statuscode;
echo "<br>";
echo $result->RRR;
echo "<br>";
echo $result->status;