PHP中foreach循环出一个表格,得到数组中的每一个值

PHP中foreach循环出一个表格,得到数组中的每一个值,第1张

<table border='1' cellpadding='0' cellspacing='0'><tr>

<php

$arr=array(

"web"=>array(

"weburl"=>">

你给出的数据组织形式,貌似是json,那么你可以直接用json_encode() 和 json_decode()进行转换后,再进行处理。

示例代码:

<php

$json = '{

"6846": {

"userid": "6846",

"expertname": "三剑客",

"firstrate": "0",

"wrong": null,

"firstqs": "2011254",

"firstvalue": "2",

"lastrate": "0",

"firstnum": "0",

"lastnum": "0",

"kjtime": "2012-09-30 00:00:00",

"successrate": "0",

"curqs": " (2012267,2012266,2012262,2012259,2011256,2011255,2011254 )",

"lastpaiming": "1",

"curpaiming": "1"

},

"9205": {

"userid": "9205",

"expertname": "东方诸葛",

"firstrate": "0",

"wrong": null,

"firstqs": "2011254",

"firstvalue": "2",

"lastrate": "0",

"firstnum": "0",

"lastnum": "0",

"kjtime": "2012-09-30 00:00:00",

"successrate": "0",

"curqs": " (2012267,2012266,2012262,2012259,2011256,2011255,2011254 )",

"lastpaiming": "2",

"curpaiming": "2"

},

"9213": {

"userid": "9213",

"expertname": "神探老李",

"firstrate": "0",

"wrong": null,

"firstqs": "2011254",

"firstvalue": "2",

"lastrate": "0",

"firstnum": "0",

"lastnum": "0",

"kjtime": "2012-09-30 00:00:00",

"successrate": "0",

"curqs": " (2012267,2012266,2012262,2012259,2011256,2011255,2011254 )",

"lastpaiming": "3",

"curpaiming": "3"

},

"17518": {

"userid": "17518",

"expertname": "草原雄鹰",

"firstrate": "0",

"wrong": null,

"firstqs": "2011254",

"firstvalue": "2",

"lastrate": "0",

"firstnum": "0",

"lastnum": "0",

"kjtime": "2012-09-30 00:00:00",

"successrate": "0",

"curqs": " (2012267,2012266,2012262,2012259,2011256,2011255,2011254 )",

"lastpaiming": "4",

"curpaiming": "4"

}

}';

echo '<Pre>';

print_r( json_decode($json,true) );

echo '</pre>';

>

以上就是关于PHP中foreach循环出一个表格,得到数组中的每一个值全部的内容,包括:PHP中foreach循环出一个表格,得到数组中的每一个值、php 怎么把接受到的数据 循环的添加到数组、php 循环二维数组取十条数据等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/9718983.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-01
下一篇 2023-05-01

发表评论

登录后才能评论

评论列表(0条)

保存