时间:2021-07-01 10:21:17 帮助过:7人阅读
可以加个start
修改 includes\cls_template.php 里面的 foreach 处理方法,找到
function _compile_foreach_start($tag_args)
在里面的输出之前添加一个
$i = $attrs['start'] ? $attrs['start'] : 0; //by neo
下面的if里面加入 $i++
if (!empty($name))
{
$foreach_props = "\$this->_foreach['$name']";
$output .= "{$foreach_props} = array('total' => count(\$_from), 'iteration' => 0, 'i' => {$i});\n";
$output .= "if ({$foreach_props}['total'] > 0):\n";
$output .= " foreach (\$_from AS $key_part$item):\n";
$output .= " {$foreach_props}['iteration']++;\n";
$output .= " {$foreach_props}['i']++;\n"; //by neo
}
start=2 试试