/* 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脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 個月前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
1 個月前By尊渡假赌尊渡假赌尊渡假赌
刺客信條陰影:貝殼謎語解決方案
3 週前ByDDD
Windows 11 KB5054979中的新功能以及如何解決更新問題
2 週前ByDDD
威爾R.E.P.O.有交叉遊戲嗎?
1 個月前By尊渡假赌尊渡假赌尊渡假赌

熱工具

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

記事本++7.3.1
好用且免費的程式碼編輯器

MinGW - Minimalist GNU for Windows
這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

WebStorm Mac版
好用的JavaScript開發工具

SublimeText3 Linux新版
SublimeText3 Linux最新版