Blogger Information
Blog 37
fans 0
comment 0
visits 34799
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php初探案例
手机用户1607314868
Original
488 people have browsed it
php与javascript的区别和联系

联系:都是脚本语言
区别:php工作在后端,js工作在前端
现在js也可以写服务器端的代码了

电影小案例

php跟html可以混编,写在同一个页面中,require是导入的意思,将另一个页面导入到本页面

  1. <?php
  2. require 'inc/config.php';
  3. $headline='国产好剧';
  4. $movies=['我的小确幸','我就是这般','这个世界'];
  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. <!-- 关键字 -->
  13. <meta name='keywords' content="<?=$keywords?>">
  14. <!-- 描述 -->
  15. <meta name='description' content="<?$desc?>">
  16. <title><?=$title?></title>
  17. </head>
  18. <body>
  19. <div class="header">
  20. <ul class="nav">
  21. <li>
  22. <a href="">首页</a>
  23. </li>
  24. <?php foreach($navs as $nav) : ?>
  25. <li><a href=""><?=$nav?></a></li>
  26. <?php endforeach ?>
  27. </ul>
  28. </div>
  29. <h2><?=$headline?></h2>
  30. <ol>
  31. <?php foreach ($movies as $movie) : ?>
  32. <li><a href=""><?=$movie?></a></li>
  33. <?php endforeach?>
  34. </ol>
  35. <div class="footer">
  36. <p class="copyright"><?=$copyright?>&copy;版权所有</p>
  37. </div>
  38. </body>
  39. </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
Author's latest blog post