服务器测试地址:http://116.196.116.164/23/6.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
p {
color: coral;
text-align: center;
font-size:1.4em
}
p input {
border-radius: 5px;
opacity: 0.3;
border:2px solid #c8cccf;
font-size:1.4em
/*border-style: none;*/
}
table{
margin: 100px auto;
border-radius: 5px;
opacity: 0.3;
border:2px solid #c19e66;
font-size:1.4em
}
button {
margin: 20px auto;
display: block;
width: 10%;
height: 40px;
background-color: #00a4a0;
border-radius: 5px;
font-size: 16px;
color: #fff;
text-align: center;
line-height: 40px;
}
</style>
</head>
<body>
</body>
</html>
<?php
header('Content-type:text/html;charset=utf-8');
echo <<<'INPUT'
<form>
<p>请输入表格的行: <input type="text" name="row" value="">列: <input type="text" name="col" value=""><button>提交</button></p>
</form>
INPUT;
echo '<hr>';
isset($_GET['row'])?$row = $_GET['row']:$row = '';
isset($_GET['col'])?$col = $_GET['col']:$col = '';
//$row = $_GET['row'];
//$col = $_GET['col'];
echo '<table border="2" cellpadding="3" cellspacing="0" width="300"> ';
for ($i=0;$i<$row;$i++){
echo '<tr>';
for ($j=0;$j<$col;$j++){
echo '<td>Hello World</td>';
}
echo '</tr>';
}
echo '</table>';
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号