PHPのお勉強



HTML_Table(PEAR)を利用@PHP

HTML_Tableを利用して、Tableを作成します。
PEARでHTML_Tableをインストールします。

HTML_Tableを生成します。
setRowCount、setColCountで行数、列数を指定します。
setCellContentsにてセルに値を挿入します。
toHtmlにてHTML文を生成します。


<?php

require_once("HTML/Table.php");

$htmlTable = new HTML_table("border='1'");

$htmlTable->setRowCount(2);
$htmlTable->setColCount(2);

$htmlTable->setCellContents(0,0,"1-1");
$htmlTable->setCellContents(0,1,"1-2");
$htmlTable->setCellContents(1,0,"2-1");
$htmlTable->setCellContents(1,1,"2-2");

print ($htmlTable->toHtml());

?>




Copyright (C) PHPのお勉強. All Rights Reserved.