本文整理匯總了PHP中HTML_Table::setCellcontents方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTML_Table::setCellcontents方法的具體用法?PHP HTML_Table::setCellcontents怎麽用?PHP HTML_Table::setCellcontents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HTML_Table
的用法示例。
在下文中一共展示了HTML_Table::setCellcontents方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
<link href="./css/style.css" rel="stylesheet" type="text/css" />
<?php
require_once "HTML/Table.php";
$salesreport = array('0' => array("12309", "45633", "2010-12-19 01:13:42", "\$22.04", "\$5.67", "\$27.71"), '1' => array("12310", "942", "2010-12-19 01:15:12", "\$11.50", "\$3.40", "\$14.90"), '2' => array("12311", "7879", "2010-12-19 01:15:22", "\$95.99", "\$15.00", "\$110.99"), '3' => array("12312", "55521", "2010-12-19 01:30:45", "\$10.75", "\$3.00", "\$13.75"));
$attributes = array('border' => '1');
$table = new HTML_Table($attributes);
$table->setHeaderContents(0, 0, "Order ID");
$table->setHeaderContents(0, 1, "Client ID");
$table->setHeaderContents(0, 2, "Order Time");
$table->setHeaderContents(0, 3, "Sub Total");
$table->setHeaderContents(0, 4, "Shipping Cost");
$table->setHeaderContents(0, 5, "Total Cost");
for ($rownum = 0; $rownum < count($salesreport); $rownum++) {
for ($colnum = 0; $colnum < 6; $colnum++) {
$table->setCellcontents($rownum + 1, $colnum, $salesreport[$rownum][$colnum]);
$table->altRowAttributes(1, null, array("class" => "alt"));
}
}
echo $table->toHTML();
?>