我有这种类型的数据存储在mysql中,我怎么能只回显金额值呢?{"1":{"amount":"700","date":"2022-10-31","amount_discount":"0","amount_fine":"0","description":"","collected_by":"John Doe","payment_mode":"Cash","received_by":"12","inv_no":1},"2":{"amount":"300","date":"2022-12-17","description":" Paid by: Jane Doe","amount_discount":0,"amount_fine":"0","payment_mode":"upi","received_by":"23","inv_no":2}}
这段代码看起来像json数据,如果是的话,我应该使用jquery来回显这些值吗?或者有没有办法在php中实现?
3条答案
按热度按时间vxbzzdmp1#
您可以使用json_decode函数将其转换为PHP对象,然后访问其属性。对于您的示例,您可以执行以下操作以获取“amount”属性:
bz4sfanl2#
ffscu2ro3#
试试这个