/* Code Revised from Sam's Teach Yourself Php, Mysql and Apache in 24 Hours (Sams Teach Yourself S.) (Paperback) by Julie C. Meloni # Paperback: 616 pages # Publisher: Sams (1 Jan 2004) # Language English # ISBN: 0672326205 */testing objectsheaders = $headers; $this->cols = count ( $headers ); } function addRow( $row ){ if ( count ($row) != $this->cols ) return false; array_push($this->table_array, $row); return true; } function addRowAssocArray( $row_assoc ) { if ( count ($row_assoc) != $this->cols ) return false; $row = array(); foreach ( $this->headers as $header ) { if ( ! isset( $row_assoc[$header] )) $row_assoc[$header] = " "; $row[] = $row_assoc[$header]; } array_push($this->table_array, $row) ; } function output() { print ""; foreach ( $this->headers as $header ) print "$header "; print "\n"; foreach ( $this->table_array as $y ) { foreach ( $y as $xcell ) print "$xcell "; print "\n"; } print ""; } } class HTMLTable extends Table{ var $bgcolor; var $cellpadding = "2"; function HTMLTable( $headers, $bg="#ffffff" ){ Table::Table($headers); $this->bgcolor=$bg; } function setCellpadding( $padding ){ $this->cellpadding = $padding; } function output(){ print ""; foreach ( $this->headers as $header ) print "$header"; foreach ( $this->table_array as $row=>$cells ) { print ""; foreach ( $cells as $cell ) print "$cell"; print ""; } print ""; } } $test = new HTMLTable( array("a","b","c"), "#00FF00"); $test->setCellpadding( 7 ); $test->addRow( array(1,2,3)); $test->addRow( array(4,5,6)); $test->addRowAssocArray( array ( b=>0, a=>6, c=>3 )); $test->output(); ?>
以上就是的内容,更多相关内容请关注PHP中文网(www.php.cn)!
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章
<🎜>:种植花园 - 完整的突变指南
4 周前ByDDD
<🎜>:泡泡胶模拟器无穷大 - 如何获取和使用皇家钥匙
4 周前By尊渡假赌尊渡假赌尊渡假赌
北端:融合系统,解释
1 个月前By尊渡假赌尊渡假赌尊渡假赌
Mandragora:巫婆树的耳语 - 如何解锁抓钩
4 周前By尊渡假赌尊渡假赌尊渡假赌

热工具

WebStorm Mac版
好用的JavaScript开发工具

SublimeText3 Linux新版
SublimeText3 Linux最新版

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

SublimeText3汉化版
中文版,非常好用

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)