Home  >  Article  >  Backend Development  >  Thinkphp中volist标签mod控制一定记录的换行BUG解决方法_php实例

Thinkphp中volist标签mod控制一定记录的换行BUG解决方法_php实例

WBOY
WBOYOriginal
2016-06-07 17:15:41622browse

本文实例讲述了Thinkphp中volist标签mod控制一定记录的换行BUG解决方法。分享给大家供大家参考。具体方法如下:

一、BUG描述:

存在于thinkphp 2.0 版本

Mod属性还用于控制一定记录的换行,例如:

复制代码 代码如下:

{$vo.name}



上述文字节选自官方手册

实际的执行结果是:
第一行 4个记录(缺少一个)
第二行及后面行才是 5个记录

二、修改意见:

ThinkPHP\Lib\Think\Template\TagLib\TagLibCx.class.php
line 107和line 108 位置互换一下
原代码:

复制代码 代码如下:
$parseStr .= '++$'.$key.';';
$parseStr .= '$mod = ($'.$key.' % '.$mod.' )?>';

修改后:
复制代码 代码如下:
$parseStr .= '$mod = ($'.$key.' % '.$mod.' );';
$parseStr .= '++$'.$key.'?>';

希望本文所述对大家的ThinkPHP框架程序设计有所帮助。

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