我想对来自目录的图像设置一个条件,如果图像计数为 1,则显示此 div。但是在对其应用条件后,条件无法正常运行。请帮我解决这个问题:我的代码如下:
<?php
$id = 115;
$path_image = "pageimage/".$id."/";
if(file_exists($path_image)){
$dir = dir($path_image);
//List files in images directory
while (($file = $dir->read()) !== false){
if($file>=1){
?>
<div id="middleimg" style="background:url(<?php echo $path_image.$file; ?>); background-repeat:no-repeat;">
<div id="nav">
<div id="navinner">
<ul>
<?php
foreach($pageMenu as $pmenu){
$url = generateURL($pmenu->custom_url, $pmenu->page_friendlyname, $pmenu->page_title, $pmenu->page_id);?>
<li><a href="<?php echo $url; ?>"><?php echo $pmenu->page_name; ?> </a> </li>
<?php } ?>
<!--<li><a href="index.php">HOME</a></li>
<li><a href="aboutus.php">ABOUT</a></li>
<li><a href="menu.php">MENU</a></li>
<li><a href="#">LOCATION</a></li>
<li><a href="deliverly.php">DELIVERY</a></li>
<li><a href="#">SPECIAL OFFER</a></li>
<li><a href="#">CONTACT</a></li>-->
</ul>
</div>
</div>
<div id="banner-containerhome">
<div id="promoBanner">
<!--<div id="pizza">-->
<div id="wowslider-container1">
<div class="ws_images">
<span><img src="data1/images/banner.jpg" alt="" title="" id="wows0"/></span>
<span><img src="data1/images/banner.jpg" alt="" title="" id="wows0"/></span>
</div>
<div class="ws_bullets"><div>
<a href="#wows0" title=""><img src="data1/tooltips/banner.jpg" alt=""/>1</a>
<a href="#wows1" title=""><img src="data1/tooltips/chrysanthemum.jpg" alt=""/>2</a>
</div></div>
<div class="ws_shadow"></div>
</div>
<script type="text/javascript" src="engine1/script.js"></script>
<!-- </div>-->
</div>
<div class="rightcontents">
<?php
echo $page_content[1]->page_content;
?>
</div>
</div>
</div>
<?php }}} ?>