【发布时间】:2021-07-08 11:02:07
【问题描述】:
<?php
$pros_array_id= array_column($_SESSION['cart'], 'paint_id');
$productee = $productn->getData('paint');
foreach($productee as $pro):
if($pro['paint_id'] == $pros_array_id):
?>
<table>
<tr>
<td class="imgTag">
<a href="#"><img class="img-fluid" src="<?php echo $pro['paint_image'] ?? 1; ?>" ></a>
</td>
</tr>
</table>
<?php
endif;
endforeach;
?>
Am trying to display session cart items and its not showing anything. When I print_r($productee) and print_r($pros_array_id) after the foreach statement both display the accurate data, yet nothing displat in the <tr> tag.
是显示结果 当我像这样内爆 $pros_array_id 时 "$imp = implode(" ",$pros_array_id);"并将变量放在 if 语句中,如果会话中只有一种产品,它可以正常工作,但是当我在会话中添加多个产品时,什么都不会再次显示。 请有人指出我应该怎么做? 谢谢
【问题讨论】: