假设我从查询结果中有这个数组:
[0]=> { ["category"]=> "fruit" ["value"]=> "banana"}
[1]=> { ["category"]=> "fruit" ["value"]=> "grape"}
[2]=> { ["category"]=> "fruit" ["value"]=> "pineapple"}
[3]=> { ["category"]=> "animal" ["value"]=> "mouse"}
[4]=> { ["category"]=> "animal" ["value"]=> "elephant"}
[5]=> { ["category"]=> "animal" ["value"]=> "ant"}
如何制作同一个组只显示一次的 HTML 表,并根据成员数td rowspan
在组字段( )中赋值?category
期望的结果:
--------------------
|fruit |banana |
| -----------
| |grape |
| -----------
| |pinapple |
--------------------
|animal |mouse |
| -----------
| |elephant |
| -----------
| |ant |
---------------------