PHP dynamically implements table cross-row and cross-column code_PHP tutorial

WBOY
Release: 2016-07-21 15:15:06
Original
892 people have browsed it

复制代码 代码如下:

< ?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 "";
}
function baobiao_danteng($name, $time_unit, $pro_name, $pre_name) {
echo "";
for ($i = 0; $i < $time_unit; $i++) {
echo "";
for ($j = 0; $j < (count($pro_name) - 1); $j++) {
echo "";
for ($i = 0; $i < $time_unit; $i++) {
echo "
" . $col1_name . "" . $col2_name . "" . $col3_name . "
$name" . $pro_name[0] . "" . $pre_name . $i . "";
}
echo "
" . $pro_name[($j + 1)] . "" . $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();

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/326139.htmlTechArticle复制代码 代码如下: ?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_un...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!