Skip to content

Instantly share code, notes, and snippets.

@pzzrudlf
Created December 14, 2015 13:10
Show Gist options
  • Select an option

  • Save pzzrudlf/a152b9fec1440ed42442 to your computer and use it in GitHub Desktop.

Select an option

Save pzzrudlf/a152b9fec1440ed42442 to your computer and use it in GitHub Desktop.
<table id="__01" class="table-responsive" border="0" cellpadding="0" cellspacing="0">
<?php
$i = 0;
$content = '';
foreach ($indexdata as $key => $value) {
if ($i%2 == 0){//每7列换一行,配合下面的判断使用
$content .= '<tr>';
}
$id = $value['id'];
$content .= '<td><a href="/default/show?id='.$id.'">'.json_decode($value['name'], true)['data']['zh-cn'].'</a></td>';
if ($i%2 == 1){//每7列换一行,配合上面的判断使用
$content .= '</tr>';
}
$i++;
}
echo $content;
?>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment