批改状态:合格
老师批语:
<?php$qd = [['a1'=>'内容1','a2'=>'内容1','a3'=>'内容1','a4'=>'内容1','a5'=>'内容1'],['b1'=>'内容2','b2'=>'内容2','b3'=>'内容2','b4'=>'内容2','b5'=>'内容2']];$head = ['头部内容1','头部内容1','头部内容1','头部内容1','头部内容1',];function tab(array $qd,$head,int $width=300){$table = '<table border="2">';$table .= '<thead>';$table .= '<tr>';foreach($head as $head_k=>$head_v){$table .= '<th width="'. $width .'">'. $head_v .'</th>';}$table .= '</tr>';$table .= '</thead>';$table .= '<tbody>';foreach($qd as $k=>$v){$table .= '<tr>';foreach($v as $kk=>$vv){$table .= '<td>'. $vv .'</td>';}$table .= '</tr>';}$table .= '</tbody>';$table .= '</table>';return $table;}?><!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title></head><body><?php echo tab($qd,$head); ?></body></html>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号