Blogger Information
Blog 47
fans 3
comment 0
visits 38265
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php开发环境、网站静态到动态的发展历史、写一个页面
Original
570 people have browsed it

1. php开发环境

windows(集成): phpstudy, wampserver, xampp,upupw…
window(原生版本):iis + php +mysql 或者 apache + php +mysql 或者 nginx+ php +mysql
macos: xampp, mamp pro / free…

  • 以下测试以phpstudy为例


2. 网站静态到动态的发展历史

.txt纯文本,不带格式
.html 格式化文本,但内容固定
.php 由服务器端动态改变内容,产生输出到html,更具多样化,从格式到内容都是可变的

3. 写一个页面

  • index.php 主体代码
  1. <!-- 公共头部 -->
  2. <?php
  3. require __DIR__.'/inc/header.php';
  4. ?>
  5. <!-- 主体 -->
  6. <h2><?=$navs[0]?></h2>
  7. <ol>
  8. <?php foreach ($movies as $movie) :?>
  9. <li><a href=""><?=$movie?></a></li>
  10. <?php endforeach ?>
  11. </ol>
  12. <!-- 公共页脚 -->
  13. <?php
  14. require __DIR__.'/inc/footer.php';
  15. ?>
  • /inc/config.php代码
  1. <?php
  2. $title = "天蓬影视";
  3. $desc = "为你搜集全网最新最快的影视资源";
  4. $keywords = "国产、港片、大陆、欧美、日韩";
  5. $copyright = "天蓬大人";
  • /inc/header.php 公共头部php代码
  1. <?php
  2. require 'config.php';
  3. $movies = ["老九门","沙海","盗墓笔记"];
  4. // 导航
  5. $navs = ["国产好剧","香港地区","欧洲地区","纪录片"];
  6. ?>
  7. <!DOCTYPE html>
  8. <html lang="en">
  9. <head>
  10. <meta charset="UTF-8">
  11. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  12. <meta name="keywords" content="<?=$keywords?>">
  13. <meta name="description" content="<?=$desc?>">
  14. <title><?=$title?></title>
  15. <style>
  16. * {
  17. padding: 0;
  18. margin: 0;
  19. box-sizing: border-box;
  20. text-decoration: none;
  21. list-style: none;
  22. }
  23. .header {
  24. background-color: pink;
  25. padding: 10px;
  26. line-height: 40px;
  27. border-bottom: 5px solid red;
  28. }
  29. .header ul {
  30. display: grid;
  31. grid-template-columns: repeat(5, 1fr);
  32. grid-template-rows: 40px;
  33. gap: 5px;
  34. text-align: center;
  35. }
  36. .header ul li {
  37. background-color: lightcyan;
  38. color: white;
  39. }
  40. .header ul li:hover {
  41. background-color: violet;
  42. }
  43. .footer {
  44. height: 30px;
  45. background-color: #999;
  46. color: white;
  47. text-align: center;
  48. line-height: 30px;
  49. }
  50. </style>
  51. </head>
  52. <body>
  53. <div class="header">
  54. <ul class="header-nav">
  55. <li><a href="">首页</a></li>
  56. <?php foreach ($navs as $nav) :?>
  57. <li><a href=""><?=$nav?></a></li>
  58. <?php endforeach ?>
  59. </ul>
  60. </div>
  • /inc/footer.php 公共页脚php代码
  1. <div class="footer">
  2. <p> <?=$copyright?> copy&copy; 版权所有</p>
  3. </div>
  4. </body>
  5. </html>
Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:
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