如果我的数组值为零,那么将如何自动隐藏我的输出
<?php if(count($rows) > 0) { ?>
<div class="apple2">
Count is: <?PHP echo count($rows);?>
</div>
<?php } ?>
<div class="apple3">
<td><input type="button" name="update1" class="btn btn-success"value="Update1" onClick="setUpdateAction();" />
<input type="submit" name="saved" value="Delete"class="btn btn-success" /></td>
</div>
<?php
foreach ($rows as $row_id => $row)
{
?>
答案 0 :(得分:2)
请看这个,我认为你需要检查计数是否大于零
<?php if(count($rows) > 0) { ?>
<div class="apple2">
Count is: <?PHP echo count($rows);?>
<div class="apple3">
<td><input type="button" name="update1" class="btn btn-success"value="Update1" onClick="setUpdateAction();" />
<input type="submit" name="saved" value="Delete"class="btn btn-success" /></td>
</div>
<?php } ?>
答案 1 :(得分:0)
<?PHP
if(count($rows) == 0){
echo 'nothing';
}else{
echo count($rows);
}
?>