<?PHP Header ("Content-type:text/html;charset=utf-8"); $str="'; $str.='<table border= "1" class= "Show_left" style= "margin-left:50px; width:auto;" >'; $str.='<tr>'; $str.='<td class= "one" align= "Center" > Category number </td>'; $str.='<td class= "one" align= "center" > category name </td>'; $str.='<td class= "one" align= "center" > Add Time </td>'; $str.='<td class= "one" align= "center" > Level </td>'; $str.='<td class= "one" align= "center" > Status </td>'; $str.='<td class= "one" align= "center" > Notes </td>'; $str.='</tr>'; for($i =0; $i <Ten; $i + +){ if($i%2==0) {$str.='<tr style= "Background-color:pink;" >'; $str.='<td align= "center" class= "one" >1</td>'; $str.='<td align= "center" class= "one" >sdasd</td>'; $str.='<td align= "center" class= "one" >fdgs</td>'; $str.='<td align= "center" class= "one" >dsfasdf</td>'; $str.='<td align= "center" class= "one" >fgdsgs</td>'; $str.='<td align= "center" class= "one" >ewrwrw</td>'; $str.='</tr>'; }Else{$str.='<tr style= "Background-color:gray;" >'; $str.='<td align= "center" class= "one" >1</td>'; $str.='<td align= "center" class= "one" >sdasd</td>'; $str.='<td align= "center" class= "one" >fdgs</td>'; $str.='<td align= "center" class= "one" >dsfasdf</td>'; $str.='<td align= "center" class= "one" >fgdsgs</td>'; $str.='<td align= "center" class= "one" >ewrwrw</td>'; $str.='</tr>'; }} $str.='</table>'; echo $str;?>
PHP interlaced color-changing output table