bet9会员登录入口

dedecms二次开发|织梦二次开发

dedecms(织梦)二次开发二次开发

bet9会员登录入口 资讯中心 织梦二次开发 PHP,KINGCMS中余数、取余的妙用

PHP,KINGCMS中余数、取余的妙用

时间:2019-04-03
PHP,KINGCMS中余数、取余的妙用 <?php $ary=array("name","egineer","sonny","tonny","pingk","apple","phone","clone","pink","colle"); foreach($ary as $key=>$value){
PHP,KINGCMS中余数、取余的妙用

<?php 
$ary=array("name","egineer","sonny","tonny","pingk","apple","phone","clone","pink","colle");
foreach($ary as $key=>$value){
$key=$key+1;
if($key%2==1){echo '<li>';}
  ?>
 <span><?php echo $key.":". $value;?></span>
  
<?php
 if($key%2==0){echo '</li>';}
};
 ?>


匹配效果:


<ul>

<li><div>aaa</div><div>bbb</div></li>

<li><div>aaa</div><div>bbb</div></li>

<li><div>aaa</div><div>bbb</div></li>

</ul>



  在kingcms写法:

{king:portal.ad listid='96' number='100'}         
<?php if ({king:i/}%2 == 1) {echo "<li>";} ?>
<div><a href="{king:_adurl/}" title="{king:title/}{king:i/}"><img src="{config:system.inst/}{king:image/}" alt="{king:title/}" /></a></div>
<?php if ({king:i/}%2 == 0) {echo "</li>";} ?>
{/king:portal.ad}

QQ在线客服在线客服
用手机扫描二维码 关闭
二维码
XML 地图 | Sitemap 地图