我有巨大的阵列。它的结构是这样的:
Array
(
[0] => Array
(
[id] => 57060
[customer] => 1
[desc] => Customer Object
(
[id] => 51716
[name] => abc xyz
[supplier] => stdClass Object
(
[@size] => 1
[Supplier] => stdClass Object
(
[@chainCode] => EP
[@id] => 13
)
)
[Types] => stdClass Object
(
[@size] => 9
[Type] => Array
(
[0] => stdClass Object
(
[@Code] => 394431
[@TypeId] => 497374
(
[@size] => 27
[Amenity] => Array
(
[0] => stdClass Object
(
[@amenityId] => 8149624
[amenity] => Air Conditioning
)
[1] => stdClass Object
(
[@amenityId] => 8149701
[amenity] =>
)
)
.....
..... and so on
我试图简单地检查上面的数组是否为空。
<table>
<tr>
<td><b>View my Reviews</b></td>
</tr>
<tr>
<td colspan=10>
<div></div>
</td>
</tr>
<?php
if (!empty($this->revArr)) {
foreach ($this->revArr as $review):
?>
<tr>
<td class="col1">
<?php echo ($review['name'] == '') ? 'a guest' : $review['name']; ?> <br/>on <span style="font-size:11px;"><?php echo date("M j, Y", strtotime($review['created_at'])); ?></span>
</td>
<td class="col2">
<span class="name"><a href="/hotelreview/<?php echo $review['hotelId']; ?>"><?php echo $review['Info']->Name; ?></a></span>
<br/>
<span class="address"><?php
echo $review['Info']->address1;
if ($review['Info']->address2 != '') {
echo ' ' . $review['Info']->address2;
}
if ($review['Info']->address3 != '') {
echo ' ' . $review['hotelInfo']->address3;
}
?></span>
<div style="margin-top:10px;">
<h4><b><?php echo ($review['title'] == '') ? 'A Review By' : $review['title']; ?></b></h4>
<p><?php
$detail = str_replace("\r", "\n", $review['detail']);
$detail = preg_replace("#\n+#", "\n", $detail);
echo str_replace("\n", "</p><p>", $detail);
?></p>
</div>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td colspan=10 style="text-align:right;">
<?php echo $pagination; ?>
</td>
</tr>
<?php } {
?>
<tr style="text-align: center;">
<td>No Review Found !!</td>
</tr>
<?php }
?>
</table>
我哪里错了?为什么最重要的条件不起作用?
需要帮忙。
谢谢。