php动态实现表格跨行跨列实现代码

前端之家收集整理的这篇文章主要介绍了php动态实现表格跨行跨列实现代码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="65215" class="copybut" id="copybut65215" onclick="doCopy('code65215')"> 代码如下:

<div class="codebody" id="code65215">
< ?PHP
/
author:xudafeng@126.com
blog:http://www.xdf.me
date:2012.7.28
*/
class danteng {
function init($col1_name,$col2_name,$col3_name,$time_unit) {
echo "<tr><th colspan=\"" . $time_unit . "\">" . $col3_name . "</tr>";
}
function baobiao_danteng($name,$time_unit,$pro_name,$pre_name) {
echo "<tr><th rowspan=\"" . count($pro_name) . "\">$name<td>" . $pro_name[0] . "</td>";
for ($i = 0; $i < $time_unit; $i++) {
echo "<td>" . $pre_name . $i . "";
}
echo "</tr>";
for ($j = 0; $j < (count($pro_name) - 1); $j++) {
echo "<tr><td>" . $pro_name[($j + 1)] . "</td>";
for ($i = 0; $i < $time_unit; $i++) {
echo "<td>" . $pre_name . $i . "";
}
echo "";
}
}
function finish() {
echo "";
}
}
?>

调用方法如下:
<div class="codetitle"><a style="CURSOR: pointer" data="56929" class="copybut" id="copybut56929" onclick="doCopy('code56929')"> 代码如下:<div class="codebody" id="code56929">
$init = new danteng();
$init -> init('类型','项目','时间单元',$time_num);
$init ->; baobiao_danteng('伏羲',$time_num,$fuxi_pro,'pre_n');
$init ->; baobiao_danteng('女娲',$nvwa_pro,'单元');
$init ->; baobiao_danteng('盘古',$pangu_pro,'啊');
$init ->; baobiao_danteng('小冶','蛋子');
$init ->; finish();

原文链接:https://www.f2er.com/php/26892.html

猜你在找的PHP相关文章

" . $col1_name . "" . $col2_name . "