我想根据计划设置表格产品中的结构,我想这样显示
+------------------+---------------+---------------+
| product1 | product2 | product3 |
+------------------+---------------+---------------+
| product1plan1 | product2plan1 | product3plan1 |
+------------------+---------------+---------------+
| prouduct1plan2 | product2plan2 | |
+------------------+---------------+---------------+
| product1plan3 | | |
+------------------+---------------+---------------+
但现在它向我展示了那样
product1 | product1plan1 | product1plan2 product2 | product2plan1 | product2plan1
这是我的代码
<table>
<thead>
<tr>
<?php
foreach( $name as $product ) {
$c = 0;
foreach ($product as $key ) {
$c++;
?>
<th>
<?php echo $key['Product']['name']; ?>
<?php for($i = 0; $i < sizeof( $key['ProductPlan'] ); $i++ ) { ?>
<th class= 'packages' id = "<?php echo $key['Product']['name'], $key['ProductPlan'][$i]['product_plan_id']?>"
onclick = "document.getElementById('<?php echo $key['Product']['name']?>').value='<?php echo $key['ProductPlan'][$i]['product_plan_id']?>';"
>
<div product_name='<?php echo $key['Product']['slug']?>' class='amounts amount-<?php echo $key['Product']['slug']?>'>
<div class='tick'>
<?php echo $this->Html->image('tick.png', array('width'=>'25', 'height'=>'25'));?>
</div>
<div class='amount'>
<?php echo $key['ProductPlan'][$i]['name'];?> $
</div>
</div>
</th>
<?php } ?>
</th>
<?php } ?>
<?php } ?>
</tr>
</thead>