PHP for循环输出输出问题
<!--问题1:下面代码怎么用PHP循环来写--><divstyle="TOP:0px;LEFT:0px"class=pub_pa><SPANstyle="TOP:0px...
<!--问题1:下面代码怎么用PHP循环来写-->
<div style="TOP: 0px; LEFT: 0px" class=pub_pa>
<SPAN style="TOP: 0px; LEFT: 0px" class=pub_pa>
<A title="" target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_02.jpg" width=391 height=338 >
</A>
</SPAN>
</div>
<div style="TOP: 338px; LEFT: 0px" class=pub_pa>
<A title="" target=_blank>
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_03.jpg" width=391 height=162 >
</A>
</div>
<div style="TOP: 503px; LEFT: 0px" class=pub_pa>
<A title="" href="#" target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_04.jpg" width=391 height=350 >
</A>
</div>
<div style="TOP: 0px; LEFT: 394px" class=pub_pa>
<A title="" href="#" target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_05.jpg" width=276 height=282 >
</A>
</div>
<div style="TOP: 285px; LEFT: 394px" class=pub_pa>
<A title="" href="#" target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_06.jpg" width=276 height=265 >
</A>
</div>
<div style="TOP: 553px; LEFT: 394px" class=pub_pa>
<A title="" href="#"target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_07.jpg" width=276 height=300 >
</A>
</div>
<div style="TOP: 0px; LEFT: 673px" class=pub_pa>
<A title="" href="#"target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_08.jpg" width=277 height=500 >
</A>
</div>
<div style="TOP: 503px; LEFT: 673px" class=pub_pa>
<A title="" href="#"target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_09.jpg" width=277 height=350 >
</A>
</div>
</div> 展开
<div style="TOP: 0px; LEFT: 0px" class=pub_pa>
<SPAN style="TOP: 0px; LEFT: 0px" class=pub_pa>
<A title="" target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_02.jpg" width=391 height=338 >
</A>
</SPAN>
</div>
<div style="TOP: 338px; LEFT: 0px" class=pub_pa>
<A title="" target=_blank>
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_03.jpg" width=391 height=162 >
</A>
</div>
<div style="TOP: 503px; LEFT: 0px" class=pub_pa>
<A title="" href="#" target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_04.jpg" width=391 height=350 >
</A>
</div>
<div style="TOP: 0px; LEFT: 394px" class=pub_pa>
<A title="" href="#" target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_05.jpg" width=276 height=282 >
</A>
</div>
<div style="TOP: 285px; LEFT: 394px" class=pub_pa>
<A title="" href="#" target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_06.jpg" width=276 height=265 >
</A>
</div>
<div style="TOP: 553px; LEFT: 394px" class=pub_pa>
<A title="" href="#"target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_07.jpg" width=276 height=300 >
</A>
</div>
<div style="TOP: 0px; LEFT: 673px" class=pub_pa>
<A title="" href="#"target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_08.jpg" width=277 height=500 >
</A>
</div>
<div style="TOP: 503px; LEFT: 673px" class=pub_pa>
<A title="" href="#"target="_blank">
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_09.jpg" width=277 height=350 >
</A>
</div>
</div> 展开
3个回答
展开全部
以这个为例子:你可以参考一下,希望能帮到你
<div style="TOP: 338px; LEFT: 0px" class=pub_pa>
<A title="" target=_blank>
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_03.jpg" width=391 height=162 >
</A>
</div>
你想循环多少次就在$count的定义,$top,$left分别在他们的TOP和LEFT
<?php
for($i=0;$i<$count;$i++){
?>
<div style="TOP: <?php echo $top;?>; LEFT: <?php echo $left;?>" class=pub_pa>
<A title="" target=_blank>
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_03.jpg" width=391 height=162 >
</A>
</div>
<?php
}
?>
<div style="TOP: 338px; LEFT: 0px" class=pub_pa>
<A title="" target=_blank>
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_03.jpg" width=391 height=162 >
</A>
</div>
你想循环多少次就在$count的定义,$top,$left分别在他们的TOP和LEFT
<?php
for($i=0;$i<$count;$i++){
?>
<div style="TOP: <?php echo $top;?>; LEFT: <?php echo $left;?>" class=pub_pa>
<A title="" target=_blank>
<IMG border=0 alt="" src="assets/images/diy/10/mod_03_03.jpg" width=391 height=162 >
</A>
</div>
<?php
}
?>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询