PHP for 拼接 写简单的表格。

function table($title,$row,$col){
	$tablehtml = "";
	$tablehtml .= "<table border='' cellspacing='' cellpadding=''>";
	$tablehtml .= "<caption>".$title."</caption>";
	
	// row
	for($i=0; $i<$row; $i++){
		$tablehtml .= "<tr>";
		// col
		for($ii=0; $ii<$col; $ii++){
			$tablehtml .= "<td>".$col."</td>";
		}
		
		$tablehtml .= "</tr>";
		
	}
	
	$tablehtml .= "</table>";
	return $tablehtml;
}


echo table('这是表题',10,40);

发表评论