Home  >  Article  >  Backend Development  >  来看看这个图里面的数字应该如何算出来

来看看这个图里面的数字应该如何算出来

WBOY
WBOYOriginal
2016-06-13 12:48:42808browse

来看看这个图里面的数字应该怎么算出来?


就是这些被红字的数字,每行3个,所有偶数行的数字应该怎么通过数学的方法算出来?
取余的话取的是纵列的数字,怎么样能把红字的偶数行给表达出来?

数学
------解决方案--------------------
smarty ??
他不是有个 cycle 控制变量吗?为什么不用!
test.php 
include_once("smarty_inc.php"); <br />
$arr=array('a','b','c','d','e','f'); <br />
$smarty->assign('arr',$arr); <br />
$smarty->display("test.tpl"); <br />
 
test.tpl 
<table width="100px"> <br />
{section name=a loop=$arr} <br />
<tr bgcolor="{cycle values="#eeeeee,#55eero"}"> <br />
<td> <br />
{$arr[a]} <br />
</td> <br />
</tr> <br />
{/section} <br />
</table>
 
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn