$status_key ="status"
$response = {"error":false,"data":{"id":16420728,"order_id":"5000","mobile_no":"9995088810","amount":20,"balance":46.89,"status":"failure","tnx_id":"","response":"Transaction Failed"}}"
$result = json_decode($response);
这打印:
{
["error"]=> bool(false)
["data"]=> object(stdClass)#24 (8) {
["id"]=> int(16420728)
["order_id"]=> string(4) "5000"
["mobile_no"]=> string(10) "9995088810"
["amount"]=> int(20)
["balance"]=> float(46.89)
["status"]=> string(7) "failure"
["tnx_id"]=> string(0) ""
["response"]=> string(18) "Transaction Failed"
}
}
现在我正在检查指定的密钥
var_dump(array_key_exist(status_key,result));
当我执行var_dump()此功能时,它返回"bool(false)"