【发布时间】:2021-08-17 01:24:39
【问题描述】:
我从 DB 获得了三个数组,一个是健康机构名称数组,另一个是交货数据,最后一个是交货数据中日期的日期数组。例如:
Array (
[0] => stdClass Object ( [health_inst_code] => 32HI083 [health_inst_name] => DHM)
[1] => stdClass Object ( [health_inst_code] => 32HI084 [health_inst_name] => THQHSB)
[2] => stdClass Object ( [health_inst_code] => 32HI085 [health_inst_name] => CHCM)
[3] => stdClass Object ( [health_inst_code] => 32HI086 [health_inst_name] => THQHV)
[4] => stdClass Object ( [health_inst_code] => 32HI087 [health_inst_name] => GHK)
)
Array (
[0] => stdClass Object ( [dd_id] => 620 [delivery_date] => 2021-05-28 [health_inst_name] => DHM [delivery_institution] => 32HI083 [total_delivery] => 8 )
[1] => stdClass Object ( [dd_id] => 621 [delivery_date] => 2021-05-27 [health_inst_name] => THQHSB [delivery_institution] => 32HI084 [total_delivery] => 0 )
[2] => stdClass Object ( [dd_id] => 619 [delivery_date] => 2021-05-27 [health_inst_name] => GHK [delivery_institution] => 32HI087 [total_delivery] => 3 )
[3] => stdClass Object ( [dd_id] => 623 [delivery_date] => 2021-05-27 [health_inst_name] => CHCM [delivery_institution] => 32HI085 [total_delivery] => 0 )
[4] => stdClass Object ( [dd_id] => 625 [delivery_date] => 2021-05-27 [health_inst_name] => THQHV [delivery_institution] => 32HI086 [total_delivery] => 1 )
[5] => stdClass Object ( [dd_id] => 523 [delivery_date] => 2021-05-26 [health_inst_name] => THQHSB [delivery_institution] => 32HI084 [total_delivery] => 4 )
[6] => stdClass Object ( [dd_id] => 522 [delivery_date] => 2021-05-26 [health_inst_name] => CHCM [delivery_institution] => 32HI085 [total_delivery] => 1 )
[7] => stdClass Object ( [dd_id] => 521 [delivery_date] => 2021-05-26 [health_inst_name] => THQHV [delivery_institution] => 32HI086 [total_delivery] => 0 )
[8] => stdClass Object ( [dd_id] => 520 [delivery_date] => 2021-05-26 [health_inst_name] => GHK [delivery_institution] => 32HI087 [total_delivery] => 1 )
[9] => stdClass Object ( [dd_id] => 518 [delivery_date] => 2021-05-26 [health_inst_name] => DHM [delivery_institution] => 32HI083 [total_delivery] => 7 )
[10] => stdClass Object ( [dd_id] => 425 [delivery_date] => 2021-05-25 [health_inst_name] => THQHV [delivery_institution] => 32HI086 [total_delivery] => 1 )
[11] => stdClass Object ( [dd_id] => 424 [delivery_date] => 2021-05-25 [health_inst_name] => CHCM [delivery_institution] => 32HI085 [total_delivery] => 0 )
[12] => stdClass Object ( [dd_id] => 422 [delivery_date] => 2021-05-25 [health_inst_name] => DHM [delivery_institution] => 32HI083 [total_delivery] => 7 )
[13] => stdClass Object ( [dd_id] => 419 [delivery_date] => 2021-05-25 [health_inst_name] => THQHSB [delivery_institution] => 32HI084 [total_delivery] => 2 )
[14] => stdClass Object ( [dd_id] => 418 [delivery_date] => 2021-05-25 [health_inst_name] => GHK [delivery_institution] => 32HI087 [total_delivery] => 2 )
[15] => stdClass Object ( [dd_id] => 336 [delivery_date] => 2021-05-24 [health_inst_name] => GHK [delivery_institution] => 32HI087 [total_delivery] => 5 )
[16] => stdClass Object ( [dd_id] => 337 [delivery_date] => 2021-05-24 [health_inst_name] => DHM [delivery_institution] => 32HI083 [total_delivery] => 6 )
[17] => stdClass Object ( [dd_id] => 338 [delivery_date] => 2021-05-24 [health_inst_name] => CHCM [delivery_institution] => 32HI085 [total_delivery] => 0 )
[18] => stdClass Object ( [dd_id] => 340 [delivery_date] => 2021-05-24 [health_inst_name] => THQHV [delivery_institution] => 32HI086 [total_delivery] => 0 )
[19] => stdClass Object ( [dd_id] => 339 [delivery_date] => 2021-05-24 [health_inst_name] => THQHSB [delivery_institution] => 32HI084 [total_delivery] => 3 )
[20] => stdClass Object ( [dd_id] => 246 [delivery_date] => 2021-05-23 [health_inst_name] => GHK [delivery_institution] => 32HI087 [total_delivery] => 0 )
[21] => stdClass Object ( [dd_id] => 255 [delivery_date] => 2021-05-23 [health_inst_name] => THQHV [delivery_institution] => 32HI086 [total_delivery] => 1 )
[22] => stdClass Object ( [dd_id] => 253 [delivery_date] => 2021-05-23 [health_inst_name] => THQHSB Bathery [delivery_institution] => 32HI084 [total_delivery] => 4 )
[23] => stdClass Object ( [dd_id] => 251 [delivery_date] => 2021-05-23 [health_inst_name] => DHM [delivery_institution] => 32HI083 [total_delivery] => 4 )
[24] => stdClass Object ( [dd_id] => 249 [delivery_date] => 2021-05-23 [health_inst_name] => CHCM [delivery_institution] => 32HI085 [total_delivery] => 0 )
[25] => stdClass Object ( [dd_id] => 197 [delivery_date] => 2021-05-22 [health_inst_name] => DHM [delivery_institution] => 32HI083 [total_delivery] => 10 )
[26] => stdClass Object ( [dd_id] => 196 [delivery_date] => 2021-05-22 [health_inst_name] => THQHV [delivery_institution] => 32HI086 [total_delivery] => 0 )
[27] => stdClass Object ( [dd_id] => 193 [delivery_date] => 2021-05-22 [health_inst_name] => THQHSB [delivery_institution] => 32HI084 [total_delivery] => 2 )
[28] => stdClass Object ( [dd_id] => 194 [delivery_date] => 2021-05-22 [health_inst_name] => GHK [delivery_institution] => 32HI087 [total_delivery] => 1 )
[29] => stdClass Object ( [dd_id] => 195 [delivery_date] => 2021-05-22 [health_inst_name] => CHCM [delivery_institution] => 32HI085 [total_delivery] => 1 )
)
Array (
[0] => stdClass Object ( [delivery_date] => 2021-05-28 )
[1] => stdClass Object ( [delivery_date] => 2021-05-27 )
[2] => stdClass Object ( [delivery_date] => 2021-05-26 )
[3] => stdClass Object ( [delivery_date] => 2021-05-25 )
[4] => stdClass Object ( [delivery_date] => 2021-05-24 )
[5] => stdClass Object ( [delivery_date] => 2021-05-23 )
[6] => stdClass Object ( [delivery_date] => 2021-05-22 )
)
我想在 PHP 中将数组显示为二维数组,如下所示:
| 2021-05-28 | 2021-05-27 | 2021-05-26| 2021-05-25 | 2021-05-24 |2021-05-23|2021-05-22 |
| | | | | | | | |
---------------------------------------------------------------------------------------------------------
| DHM | 8 | - | 7 | 7 | 6 | 4 | 10
| THQHSB | - | 0 | 4 | 2 | 3 | 4 | 2
| CHCM | - | 0 | 1 | 0 | 0 | 0 | 1
| THQHV | - | 1 | 0 | 1 | 0 | 1 | 0
| GHK | - | 3 | 1 | 2 | 5 | 0 | 1
我该怎么做?
【问题讨论】:
标签: php