<?php echo <<< 'INPUT' <form> 请输入行:<input type="text" name="row">列:<input type="text" name="col"><button>提交</button> </form> INPUT; $row = $_GET['row']; $col = $_GET['col']; echo '<table border="1" cellspacing="0" cellpadding="2" width="350px" align="center">'; for ($i=0; $i<$row; $i++) { echo '<tr>'; for ($j=0; $j<$col; $j++) { echo '<td align="center" width="20px">'.($i*$col+$j).'</td>'; } }