用PHP展示如下图所示学生信息表,将代码及运行结果拍照上传。
学号 姓名 性别 出生日期 班级
学号                 姓名   性别   出生日期             班级              总分
G18101301 张三   女 2000-9-1         计应181           379
G18101302 李四  男 1999-12-10 软件182           308
G18101303 王五  女 2000-5-19 软件185           286
G18101304 赵六  男 2000-6-3         计网182           295
G18101305 陈七  男 19999-10-6 计应182           276

解决方案 »

  1.   

    运行截图:
    源代码:<?php
    $config = array(
    0 => array(
    'student_id' => 'G18101301',
    'name' => '张三',
    'gender' => '女',
    'date_of_birth' => '2000-9-1',
    'class' => '计应181',
    'total_points' => 379
    ),
    1 => array(
    'student_id' => 'G18101302',
    'name' => '李四',
    'gender' => '男',
    'date_of_birth' => '1999-12-10',
    'class' => '软件182',
    'total_points' => 308
    ),
    2 => array(
    'student_id' => 'G18101303',
    'name' => '王五',
    'gender' => '女',
    'date_of_birth' => '2000-5-19',
    'class' => '软件185',
    'total_points' => 286
    ),
    3 => array(
    'student_id' => 'G18101304',
    'name' => '赵六',
    'gender' => '男',
    'date_of_birth' => '2000-6-3',
    'class' => '计网182',
    'total_points' => 295
    ),
    4 => array(
    'student_id' => 'G18101305',
    'name' => '陈七',
    'gender' => '男',
    'date_of_birth' => '1999-10-6',
    'class' => '计应182',
    'total_points' => 276
    )
    );echo '
    <table border="1">
    <tr>
    <th>学号</th>
    <th>姓名</th>
    <th>性别</th>
    <th>出生日期</th>
    <th>班级</th>
    <th>总分</th>
    </tr>
    ';
    for($i = 0; $i < count($config); $i++) {
    echo '<tr>';
    foreach($config[$i] as $v) {
    echo "<td>$v</td>";
    }
    echo '</tr>';
    }
    echo '</table>';/*
           学号          姓名   性别   出生日期             班级           总分
    G18101301    张三    女      2000-9-1         计应181        379
    G18101302    李四    男    1999-12-10      软件182        308
    G18101303    王五    女     2000-5-19       软件185        286
    G18101304    赵六    男     2000-6-3         计网182        295
    G18101305    陈七    男    1999-10-6        计应182        276
    */