Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 css 中有十个跨度,它们都有不同的宽度:span1、span2、span3...、span10。
我想循环一系列帖子并以随机跨度名称显示每个帖子......
如果没有在 html 中硬编码跨度并使用多个查询,我怎么能实现这样的目标?
<?php $posts=array('a','b','c'); $rand=range(1,10); shuffle($rand); $count=current($rand); foreach($posts as $p){ echo '<span style="css'.$rand[$count].'">'.$p.'</span>'; $count=next($rand); }