|
< ?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 "";
}
}
?>
調(diào)用方法如下:
復(fù)制代碼 代碼如下:
$init = new danteng();
$init -> init('類型', '項(xiàng)目', '時(shí)間單元', $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();
php技術(shù):php動(dòng)態(tài)實(shí)現(xiàn)表格跨行跨列實(shí)現(xiàn)代碼,轉(zhuǎn)載需保留來(lái)源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。