此问题在此处已有答案:
How to extract and access data from JSON with PHP?(1个答案)
How can I access an array/object?(6个答案)
昨天关门了。
我已经使用jquery生成了html表数据到Json数组,它为我工作,我得到了下面的数组,我需要php代码来迭代php codeigniter 4控制器中这个数组的每个值。
array(1){
[
0
]=>string(966)"[{"ID":"\n2","Name":"\nCP","Price":"\n350.20"},{"ID":"\n3","Name":"\nLFT","Price":"\n700.10"},{"ID":"\n4","Name":"\nRFT","Price":"\n200"},{"ID":"\n5","Name":"\nurinetest","Price":"\n1000"}]"
}
1条答案
按热度按时间fjaof16o1#
这是一个包含json数组的php数组,如果你确定你在数组中只有一个元素,你可以这样做:
否则: