我正在學習有關課程,現在在PHP和他們的例子是如..我應該把什麼東西放進課堂,我不應該做什麼?
class table { //makes a table
private $tag ;
function Begin($border=0, $align="center", $width='100%', $cellpadding=2,
$cellspacing=2, $class='', $id='', $bgcolor='', $style='') {
$this->tag = '<table ' ;
if ($align) $this->tag .= 'align="' . $align . '" ' ;
if ($width) $this->tag .= 'width="' . $width . '" ' ;
if ($border > 0) $this->tag .= 'border="' . $border . '" ' ;
if ($cellpadding > 0) $this->tag .= 'cellpadding="' . $cellpadding . '" ' ;
if ($cellspacing > 0) $this->tag .= 'cellspacing="' . $cellspacing . '" ' ;
if ($class) $this->tag .= 'class="' . $class . '" ' ;
if ($id) $this->tag .= 'id="' . $id . '" ' ;
if ($bgcolor) $this->tag .= 'bgcolor="' . $bgcolor . '" ' ;
if ($style) $this->tag .= 'style="' . $style . '" ' ;
$this->tag .= ">" ;
return $this->tag ;
}
然後你只需實例並通過
$table =new table;
$table->$table($border=2, $align='center', etc);
我應該編碼喜歡這個地方HTML做一個表,CSS是在課堂上? 我覺得以這種方式製作表格和表格會更困惑,然後實際上只是打字。我只應該像驗證,從數據庫中獲取數據,以及類中的邏輯東西嗎?
我應該使用什麼類而不是?
你在哪裏得到這個例子?誰寫的,應該被槍殺。 – 2010-05-27 20:40:15