1. 学习PHP为什么必须要掌握HTML?
html/css/javascript 都是前端的,给浏览器执行、渲染的,本地打开就可以看到效果。早期的网站都是静态(html)的,有多少个页面就要有多少个html文件,1000条新闻要1000个html页面,而php等动态网站,只要一个php文件就够了,所以叫动态,动态网站才可以交互,比如用户留言什么的。html收集数据提交给php处理,然后php再把数据返回给html显示!
2.为什么选择PHP开发动态网站?
因为PHP快捷,迭代快。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表格学习</title>
<style type="text/css">
table {
border-collapse: collapse; /*折叠表格线*/
width: 800px;
text-align: center;
margin: 25px auto;
}
table caption {
font-size: 1.5rem;
font-weight: bolder;
color: #666;
margin-bottom: 20px;
}
table, th, td {
border: 1px solid #666;
}
table tr:first-child {
background-color: pink;
}
table tr:hover {
background-color: #efefef;
color: skyblue;
}
table tr td img {
padding: 5px;
border-radius: 10px;
}
table tr td a {
text-decoration: none;
width:140px;
height:40px;
padding:5px;
border:1px solid black;
background: white;
color:black;
border-radius: 8px;
}
table tr td a:hover {
background: black;
color:white;
}
</style>
</head>
<body>
<table>
<caption>摄影购物清单</caption>
<tr>
<th>编号</th>
<th>名称</th>
<th>Band</th>
<th>数量</th>
<th>约略图</th>
<th>Buy</th>
</tr>
<tr>
<td>1</td>
<td>E-M5 Mark II</td>
<td>奥林巴斯</td>
<td>1台</td>
<td><img src="images/em5mii.jpg" width="100"></td>
<td><a href="http://jd.com">点击Buy</a></td>
</tr>
<tr>
<td>2</td>
<td>M.ZUIKO 12-40mm F2.8</td>
<td>奥林巴斯</td>
<td>1个</td>
<td><img src="images/12-40.jpg" width="100"></td>
<td><a href="http://jd.com">点击Buy</a></td>
</tr>
<tr>
<td>3</td>
<td>M.ZUIKO ED 75–300mm-II</td>
<td>奥林巴斯</td>
<td>1个</td>
<td><img src="images/75-300.jpg" width="100"></td>
<td><a href="http://jd.com">点击Buy</a></td>
</tr>
</table>
</body>
</html>点击 "运行实例" 按钮查看在线实例
运行效果图:

总结:html直接画表格是基础,后面要用php动态生成表格。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号