无为清净楼资源网 Design By www.qnjia.com
复制代码 代码如下:
< ?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 "<table border=1><tr><th>" . $col1_name . "</th><th>" . $col2_name . "</th><th colspan=\"" . $time_unit . "\">" . $col3_name . "</th></tr>";
}
function baobiao_danteng($name, $time_unit, $pro_name, $pre_name) {
echo "<tr><th rowspan=\"" . count($pro_name) . "\">$name</th><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 "";
}
}
?>

调用方法如下:
复制代码 代码如下:
$init = new danteng();
$init -> init('类型', '项目', '时间单元', $time_num);
$init ->; baobiao_danteng('伏羲', $time_num, $fuxi_pro, 'pre_n');
$init ->; baobiao_danteng('女娲', $time_num, $nvwa_pro, '单元');
$init ->; baobiao_danteng('盘古', $time_num, $pangu_pro, '啊');
$init ->; baobiao_danteng('小冶', $time_num, $pangu_pro, '蛋子');
$init ->; finish();
标签:
表格跨行跨列

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com