Blogger Information
Blog 31
fans 0
comment 0
visits 24376
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Day23-2017/12/26(乘法表)
SmallKing的博客
Original
1132 people have browsed it

要求:

  1. 表格生成器;

    2. 九九乘法表;

乘法表生成器

M_table.php

<?php
header("Content-type: text/html; charset=utf-8");
echo '<h2 align="center">乘法表生成器</h2><hr>';
//显示一个输入框以及按钮
echo <<<'TABLE'
<form align="center">
    请输入乘法表大小:<input type="text" name="row" placeholder="例如:99乘法表输入9">
    <button>提交</button>
</form>
TABLE;
$row=9;//声明一个变量ROW记录乘法表所需要的行,默认99乘法表
if (isset($_GET['row'])) {$row=$_GET['row'];} //判断用户是否有数据输入
//利用双循环输出乘法表
echo '<table align="center" cellpadding="3" cellspacing="5" border="10" style="background-color: yellowgreen;text-align:center;border-radius: 10px" >';
echo '<caption style="color: green;font-size: 2em">\''.$row.'\'\''.$row.'\'乘法表</caption>';//标题
//表格
for ($i=1;$i<=$row;$i++){
    echo '<tr>';
    for ($j=1;$j<=$i;$j++) {
        echo '<td  style="border: solid 1px whitesmoke;background-color: blanchedalmond;border-radius: 5px;min-width:70px">'.$j.'×'.$i.'='.$i*$j.'</td>';
    }
    echo '</tr>';
}
echo '</table>';


效果图

99乘法表.png5阶乘法表.png


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post