Blogger Information
Blog 9
fans 3
comment 0
visits 11053
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0110作业:静态网站模拟动态化
十年一梦
Original
900 people have browsed it

0110作业:静态网站模拟动态化

动态网站和静态分析

  • 在我们常见的网站中,大部分都是动态化数据填充;
  • 动态网站能最简单的保证网站最快的更新;
  • 动态网站是一次投入,在以后的运行中,不必要去改动网页代码;
  • 动态网站把所有数据保存到数据库,利于数据的安全;

网站示例

网站首页

  • 首页运行图

  • 首页index.php 代码
  1. <?php include __DIR__ . '/inc/public_header.php' ?>
  2. <?php
  3. //调用栏目名称
  4. function catListName($cid, $catLists)
  5. {
  6. foreach ($catLists as $catList) {
  7. if ($catList['cid'] === $cid) {
  8. //当参数过来的cid和栏目的cid相等输出栏目名字
  9. $catListName = $catList['name'];
  10. }
  11. }
  12. return $catListName;
  13. }
  14. //调用随机小说函数
  15. function randomBooks($bookLists, $num)
  16. {
  17. $bookListIds = array_rand($bookLists, $num);
  18. foreach ($bookListIds as $bookListId) {
  19. $bookRandLists[] = $bookLists[$bookListId];
  20. }
  21. return $bookRandLists;
  22. }
  23. $bookRandLists = randomBooks($bookLists, 6);
  24. ?>
  25. <!--小说内容区域-->
  26. <main>
  27. <!--随机小说-->
  28. <div class="book-list">
  29. <div class="book-title"><span>随机推荐</span></div>
  30. <div class="b-lists">
  31. <?php foreach ($bookRandLists as $randList): ?>
  32. <div class="b-list">
  33. <a href="<?= $randList['url'] ?>"><img src="<?= PIC_PATH . $randList['pic'] ?>" alt=""></a>
  34. <div class="b-list-wenzi">
  35. <a href="<?= $randList['url'] ?>"><?= $randList['name'] ?></a>
  36. <span><?= $randList['summary'] ?></span>
  37. <div>
  38. <span><i class="iconfont icon-zuozhe"></i><?= $randList['author'] ?></span>
  39. <span><?= catListName($randList['cid'], $catLists); ?></span>
  40. </div>
  41. </div>
  42. </div>
  43. <?php endforeach ?>
  44. </div>
  45. </div>
  46. <!--小说循环-->
  47. <?php foreach ($catLists as $catList): ?>
  48. <div class="book-list">
  49. <div class="book-title"><span><?= $catList['name'] ?></span></div>
  50. <div class="b-lists">
  51. <?php foreach ($bookLists as $bookList): ?>
  52. <!--输出当前栏目ID的小说-->
  53. <?php if ($catList['cid'] === $bookList['cid']): ?>
  54. <div class="b-list">
  55. <a href="<?= $bookList['url'] ?>"><img src="<?= PIC_PATH . $bookList['pic'] ?>" alt=""></a>
  56. <div class="b-list-wenzi">
  57. <a href="<?= $bookList['url'] ?>"><?= $bookList['name'] ?></a>
  58. <span><?= $bookList['summary'] ?></span>
  59. <div>
  60. <span><i class="iconfont icon-zuozhe"></i><?= $bookList['author'] ?></span>
  61. <span><?= catListName($bookList['cid'], $catLists); ?></span>
  62. </div>
  63. </div>
  64. </div>
  65. <?php endif; ?>
  66. <?php endforeach ?>
  67. </div>
  68. </div>
  69. <?php endforeach ?>
  70. </main>
  71. <?php include __DIR__ . '/inc/public_footer.php' ?>

网站小说列表页

  • 列表页运行图

  • 列表页 list.php 代码
  1. <!--引入头部文件-->
  2. <?php include __DIR__.'/inc/public_header.php'?>
  3. <?php
  4. $cid = $_GET['cid'];
  5. //调用栏目名称
  6. function catListName ($cid,$catLists){
  7. foreach ($catLists as $catList){
  8. if($catList['cid'] === intval($cid)){
  9. //当参数过来的cid和栏目的cid相等输出栏目名字
  10. $catListName = $catList['name'];
  11. }
  12. }
  13. return $catListName;
  14. }
  15. $catListName = catListName($cid,$catLists);
  16. //调用小说列表
  17. function bookList ($bookLists,$cid){
  18. foreach ($bookLists as $bookList){
  19. if($bookList['cid'] === intval($cid)) {
  20. $currentLists[] = $bookList;
  21. }
  22. }
  23. return $currentLists;
  24. }
  25. $currentLists = bookList($bookLists,$cid);
  26. //print_r($currentLists);
  27. ?>
  28. <!--小说内容区域-->
  29. <main>
  30. <!--小说列表-->
  31. <div class="book-list">
  32. <div class="book-title"><span><?=$catListName?></span></div>
  33. <div class="b-lists">
  34. <?php foreach ($currentLists as $currentList):?>
  35. <div class="b-list">
  36. <a href="<?=$currentList['url'] ?>"><img src="<?=PIC_PATH.$currentList['pic'] ?>" alt=""></a>
  37. <div class="b-list-wenzi">
  38. <a href="<?=$currentList['url'] ?>"><?=$currentList['name'] ?></a>
  39. <span><?=$currentList['summary'] ?></span>
  40. <div>
  41. <span><i class="iconfont icon-zuozhe"></i><?=$currentList['author'] ?></span>
  42. <span><?=$catListName?></span>
  43. </div>
  44. </div>
  45. </div>
  46. <?php endforeach ?>
  47. </div>
  48. </div>
  49. </main>
  50. <!--引入页脚文件-->
  51. <?php include __DIR__.'/inc/public_footer.php'?>

网站专题页

  • 网站专题随机推荐阅读页面运行图

  • 网站专题random.php 代码
  1. <!--引入头部文件-->
  2. <?php include __DIR__ . '/inc/public_header.php' ?>
  3. <?php
  4. //调用栏目名称
  5. function catListName($cid, $catLists)
  6. {
  7. foreach ($catLists as $catList) {
  8. if ($catList['cid'] === $cid) {
  9. //当参数过来的cid和栏目的cid相等输出栏目名字
  10. $catListName = $catList['name'];
  11. }
  12. }
  13. return $catListName;
  14. }
  15. //调用随机小说函数
  16. function randomBooks($bookLists, $num)
  17. {
  18. $bookListIds = array_rand($bookLists, $num);
  19. foreach ($bookListIds as $bookListId) {
  20. $bookRandLists[] = $bookLists[$bookListId];
  21. }
  22. return $bookRandLists;
  23. }
  24. $bookRandLists = randomBooks($bookLists, 6);
  25. ?>
  26. <main>
  27. <!--随机小说-->
  28. <div class="book-list">
  29. <div class="book-title"><span>随机推荐</span></div>
  30. <div class="b-lists">
  31. <?php foreach ($bookRandLists as $randList): ?>
  32. <div class="b-list">
  33. <a href="<?= $randList['url'] ?>"><img src="<?= PIC_PATH . $randList['pic'] ?>" alt=""></a>
  34. <div class="b-list-wenzi">
  35. <a href="<?= $randList['url'] ?>"><?= $randList['name'] ?></a>
  36. <span><?= $randList['summary'] ?></span>
  37. <div>
  38. <span><i class="iconfont icon-zuozhe"></i><?= $randList['author'] ?></span>
  39. <span><?= catListName($randList['cid'], $catLists); ?></span>
  40. </div>
  41. </div>
  42. </div>
  43. <?php endforeach ?>
  44. </div>
  45. </div>
  46. </main>
  47. <!--引入页脚文件-->
  48. <?php include __DIR__ . '/inc/public_footer.php' ?>

网站内容详情页

  • 详情页运行图

  • 详情页info.php 代码
  1. <?php include __DIR__ . '/inc/public_header.php' ?>
  2. <?php
  3. //接收商品ID
  4. $id = $_GET['id'];
  5. //调用小说信息
  6. function getBook($id, $bookLists)
  7. {
  8. foreach ($bookLists as $bookList) {
  9. if ($bookList['id'] === intval($id)) {
  10. $getBook = $bookList;
  11. }
  12. }
  13. return $getBook;
  14. }
  15. $getBook = getBook($id, $bookLists);
  16. //获取当前父栏目名字
  17. $cid = $getBook['cid'];
  18. function catListName($cid, $catLists)
  19. {
  20. foreach ($catLists as $catList) {
  21. if ($catList['cid'] === intval($cid)) {
  22. //当参数过来的cid和栏目的cid相等输出栏目名字
  23. $catListName = $catList['name'];
  24. }
  25. }
  26. return $catListName;
  27. }
  28. $catListName = catListName($cid, $catLists);
  29. print_r($catListName);
  30. ?>
  31. <div class="info">
  32. <div class="info-top">
  33. <a href=""><img src="<?= PIC_PATH . $getBook['pic'] ?>" alt=""></a>
  34. <div>
  35. <div><span><?= $getBook['name'] ?></span><span><?= $getBook['author'] ?></span></div>
  36. <div>
  37. <span><?= $getBook['status'] ?></span><span><?= $getBook['sign'] ?></span><span><?= $getBook['price'] ?></span><span><?= $catListName ?></span>
  38. </div>
  39. <div>
  40. <span><i><?= $getBook['word'] ?></i>万字</span><span><i><?= $getBook['overall'] ?></i>总推荐</span><span><i><?= $getBook['Weekly'] ?></i>周推荐</span>
  41. </div>
  42. <div>
  43. <a href="">免费试读</a>
  44. <a href="">加入书架</a>
  45. <a href="">投票互动</a>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="info-cont">
  50. <span>作品信息</span>
  51. <span><?= $getBook['intro'] ?></span>
  52. </div>
  53. </div>
  54. <?php include __DIR__ . '/inc/public_footer.php' ?>

网站公共部分代码

  • 头部public_header.php 代码
  1. <!--公共头部-->
  2. <?php include './config/config.php' ?>
  3. <!doctype html>
  4. <html lang="en">
  5. <head>
  6. <meta charset="UTF-8">
  7. <meta name="viewport"
  8. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  9. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  10. <link rel="stylesheet" href="static/css/style.css">
  11. <link rel="stylesheet" href="static/font/iconfont.css">
  12. <title>小说阅读网</title>
  13. </head>
  14. <body>
  15. <header>
  16. <a href="index.php">网站首页</a>
  17. <a href="random.php">随机推荐</a>
  18. <?php foreach ($catLists as $catList): ?>
  19. <a href="<?= $catList['url'] ?>"><?= $catList['name'] ?></a>
  20. <?php endforeach; ?>
  21. </header>
  • 页脚public_footer.php 代码
  1. <!--公共底部-->
  2. <footer>
  3. <?php foreach ($tabBars as $tabBar):?>
  4. <a href="<?=$tabBar['url']?>"><i class="iconfont <?=$tabBar['icon']?>"></i><?=$tabBar['name']?></a>
  5. <?php endforeach;?>
  6. </footer>
  7. </body>
  8. </html>

公共css 代码

  1. /*页面元素初始化*/
  2. * {
  3. margin: 0;
  4. padding: 0;
  5. }
  6. body {
  7. font-size: 13px;
  8. color: #888888;
  9. background-color: #EDEFF0;
  10. display: flex;
  11. flex-direction: column;
  12. min-width: 360px;
  13. max-width: 768px;
  14. margin: 0 auto;
  15. overflow-x: hidden;
  16. -webkit-column-rule-color: transparent;
  17. }
  18. a {
  19. text-decoration: none;
  20. color: #404040;
  21. font-size: 13px;
  22. }
  23. li {
  24. list-style: none;
  25. }
  26. /*header 部分*/
  27. header {
  28. height: 40px;
  29. background: #333333;
  30. line-height: 40px;
  31. display: flex;
  32. justify-content: space-around;
  33. position: fixed;
  34. width: 100%;
  35. min-width: 360px;
  36. max-width: 768px;
  37. top: 0;
  38. }
  39. header > a {
  40. color: white;
  41. }
  42. header > a:hover {
  43. color: #999999;
  44. }
  45. /*小说列表*/
  46. main {
  47. display: flex;
  48. flex-direction: column;
  49. margin: 50px 0;
  50. flex: 1;
  51. }
  52. main > .book-list {
  53. display: flex;
  54. flex-direction: column;
  55. background-color: white;
  56. padding: 10px 0;
  57. margin-top: 10px;
  58. }
  59. main > .book-list > .book-title {
  60. height: 30px;
  61. font-size: 20px;
  62. padding: 10px 5px 5px 5px;
  63. border-bottom: 1px solid #999999;
  64. }
  65. main > .book-list > .b-lists {
  66. display: flex;
  67. flex-wrap: wrap;
  68. margin-top: 10px;
  69. }
  70. main > .book-list > .b-lists > .b-list {
  71. width: 33.33333%;
  72. display: flex;
  73. padding: 5px;
  74. box-sizing: border-box;
  75. }
  76. main > .book-list > .b-lists > .b-list > a > img {
  77. width: 72px;
  78. height: 96px;
  79. }
  80. main > .book-list > .b-lists > .b-list > .b-list-wenzi {
  81. padding-left: 10px;
  82. box-sizing: border-box;
  83. display: flex;
  84. flex-direction: column;
  85. justify-content: space-between;
  86. }
  87. main > .book-list > .b-lists > .b-list > .b-list-wenzi > a {
  88. font-size: 16px;
  89. color: #333333;
  90. }
  91. main > .book-list > .b-lists > .b-list > .b-list-wenzi > span {
  92. font-size: 12px;
  93. }
  94. main > .book-list > .b-lists > .b-list > .b-list-wenzi > div {
  95. display: flex;
  96. justify-content: space-between;
  97. }
  98. main > .book-list > .b-lists > .b-list > .b-list-wenzi > div > span:last-of-type {
  99. padding: 0 3px;
  100. border: 1px solid #999999;
  101. font-size: 12px;
  102. }
  103. main > .book-list > .b-lists > .b-list > .b-list-wenzi > div > span:first-of-type > i {
  104. font-size: 14px;
  105. margin-right: 5px;
  106. }
  107. /*footer区*/
  108. footer {
  109. background-color: #333333;
  110. display: flex;
  111. justify-content: space-around;
  112. padding: 5px 0;
  113. box-sizing: border-box;
  114. position: fixed;
  115. width: 100%;
  116. min-width: 360px;
  117. max-width: 768px;
  118. bottom: 0;
  119. }
  120. footer > a {
  121. display: flex;
  122. flex-direction: column;
  123. text-align: center;
  124. color: white;
  125. font-size: 12px;
  126. }
  127. footer > a:hover {
  128. color: #999999;
  129. }
  130. footer > a > i {
  131. font-size: 16px;
  132. padding-bottom: 3px;
  133. }
  134. /*内容页*/
  135. .info {
  136. margin-top: 50px;
  137. background-color: white;
  138. padding: 5px;
  139. display: flex;
  140. flex-direction: column;
  141. }
  142. .info > .info-top {
  143. display: flex;
  144. }
  145. .info > .info-top > a {
  146. width: 144px;
  147. height: 192px;
  148. padding: 10px;
  149. }
  150. .info > .info-top > a > img {
  151. width: 144px;
  152. height: 192px;
  153. box-shadow: 0 0 3px #888888;
  154. }
  155. .info > .info-top > div {
  156. padding: 10px;
  157. display: flex;
  158. flex-direction: column;
  159. justify-content: space-between;
  160. }
  161. .info > .info-top > div > div:first-of-type > {
  162. display: flex;
  163. }
  164. .info > .info-top > div > div:first-of-type > span:first-of-type {
  165. font-size: 28px;
  166. font-weight: bold;
  167. color: #333333;
  168. padding-right: 20px;
  169. box-sizing: border-box;
  170. }
  171. .info > .info-top > div > div:nth-child(2) {
  172. display: flex;
  173. padding: 15px 0;
  174. box-sizing: border-box;
  175. }
  176. .info > .info-top > div > div:nth-child(2) > span {
  177. padding: 2px 10px;
  178. border-radius: 10px;
  179. border: 1px solid #888888;
  180. margin: 0 5px;
  181. }
  182. .info > .info-top > div > div:nth-child(2) > span:last-of-type {
  183. color: red;
  184. border: 1px solid red;
  185. }
  186. .info > .info-top > div > div:nth-child(3) {
  187. display: flex;
  188. padding: 10px 0;
  189. }
  190. .info > .info-top > div > div:nth-child(3) > span {
  191. font-size: 12px;
  192. margin: 0 5px;
  193. }
  194. .info > .info-top > div > div:nth-child(3) > span > i {
  195. font-size: 20px;
  196. font-weight: bold;
  197. color: #2d353c;
  198. font-style: normal;
  199. padding: 0 2px;
  200. }
  201. .info > .info-top > div > div:last-of-type {
  202. display: flex;
  203. }
  204. .info > .info-top > div > div:last-of-type > a {
  205. border: 1px solid #3F5A93;
  206. padding: 5px 15px;
  207. font-size: 16px;
  208. margin-right: 20px;
  209. color: #3F5A93;
  210. }
  211. .info > .info-top > div > div:last-of-type > a:first-of-type {
  212. background-color: red;
  213. color: white;
  214. border: 1px solid red;
  215. }
  216. .info > .info-top > div > div:last-of-type > a:first-of-type:hover {
  217. background-color: #f64c59;
  218. color: #eeeeee;
  219. }
  220. /*作品详情页信息*/
  221. .info > .info-cont {
  222. display: flex;
  223. flex-direction: column;
  224. }
  225. .info > .info-cont > span:first-of-type {
  226. margin-top: 20px;
  227. border-bottom: 2px solid red;
  228. font-size: 18px;
  229. color: red;
  230. width: 100px;
  231. text-align: center;
  232. padding: 10px 0;
  233. }
  234. .info > .info-cont > span:last-of-type {
  235. border-top: 1px solid #888888;
  236. margin-top: -1px;
  237. padding: 20px;
  238. }

模拟数据config.php 代码

  1. <?php
  2. //网站名字
  3. $webName = '小说阅读手机版';
  4. //图片路径
  5. const PIC_PATH = 'static/';
  6. //栏目导航
  7. $catLists = [
  8. ['cid' => 1, 'name' => '都市小说', 'url' => 'list.php?cid=1'],
  9. ['cid' => 2, 'name' => '仙侠小说', 'url' => 'list.php?cid=2'],
  10. ];
  11. //底部导航
  12. $tabBars = [
  13. ['fid' => 1, 'name' => '书架', 'url' => 'tab_bar.php?fid=1', 'icon' => 'icon-shujia'],
  14. ['fid' => 2, 'name' => '精选', 'url' => 'tab_bar.php?fid=2', 'icon' => 'icon-jingxuan'],
  15. ['fid' => 3, 'name' => '发现', 'url' => 'tab_bar.php?fid=3', 'icon' => 'icon-faxian'],
  16. ['fid' => 4, 'name' => '我的', 'url' => 'tab_bar.php?fid=4', 'icon' => 'icon-wode'],
  17. ];
  18. //小说列表
  19. $bookLists = [
  20. [
  21. 'id' => 1,
  22. 'cid' => 1,
  23. 'name' => '巨星从影视学院开始',
  24. 'pic' => 'images/juxing.jpg',
  25. 'url' => 'info.php?id=1',
  26. 'author' => '进击的咸鸭蛋',
  27. 'summary' => '重生过去、畅想未来、梦幻现实,再塑传奇人生!',
  28. 'status' => '连载',
  29. 'sign' => '签约',
  30. 'price' => '免费',
  31. 'word' => '16.17',
  32. 'overall' => '8734',
  33. 'Weekly' => '2037',
  34. 'intro' => '简介:韩飞毫无预兆的穿越了,还没等他彻底消化原主的记忆,却要面对一场事关终生的考试——艺考!于是,他一把抢过旁边女同学的化妆镜,嗯,不错,很帅,那么艺考还是问题吗?',
  35. ],
  36. [
  37. 'id' => 2,
  38. 'cid' => 1,
  39. 'name' => '演员请就位',
  40. 'pic' => 'images/yanyuan.jpg',
  41. 'url' => 'info.php?id=2',
  42. 'author' => '楼下赫本',
  43. 'summary' => '重生过去、畅想未来、梦幻现实,再塑传奇人生!',
  44. 'status' => '连载',
  45. 'sign' => '签约',
  46. 'price' => '免费',
  47. 'word' => '6.69',
  48. 'overall' => '5870',
  49. 'Weekly' => '1105',
  50. 'intro' => '影帝许先莫名其妙来到了平行世界,成为了流量小生预备役节目《初代》中的一员。上辈子因为颜值问题挨够了社会的毒打,这辈子有了一副好皮囊,许先琢磨着,或许也可以尝试一下躺着赚钱…直到有人质疑他的演技。',
  51. ],
  52. [
  53. 'id' => 3,
  54. 'cid' => 1,
  55. 'name' => '体验派影帝',
  56. 'pic' => 'images/tiyan.jpg',
  57. 'url' => 'info.php?id=3',
  58. 'author' => '黑色的单车',
  59. 'summary' => '重生过去、畅想未来、梦幻现实,再塑传奇人生!',
  60. 'status' => '连载',
  61. 'sign' => '签约',
  62. 'price' => '免费',
  63. 'word' => '13.17',
  64. 'overall' => '19734',
  65. 'Weekly' => '5368',
  66. 'intro' => '当个演员是种什么体验?向阳,衡店大神兼职亚洲普通青年,重生了。这次他想好好体验体验。从《亮剑》开始,每一个角色,无论复杂还是简单,都是一段人生,都有苦辣酸甜。',
  67. ],
  68. [
  69. 'id' => 4,
  70. 'cid' => 1,
  71. 'name' => '我有一座深山老林',
  72. 'pic' => 'images/woyou.jpg',
  73. 'url' => 'info.php?id=4',
  74. 'author' => '湖蛟',
  75. 'summary' => '重生过去、畅想未来、梦幻现实,再塑传奇人生!',
  76. 'status' => '连载',
  77. 'sign' => '签约',
  78. 'price' => '免费',
  79. 'word' => '12.17',
  80. 'overall' => '7734',
  81. 'Weekly' => '2537',
  82. 'intro' => '韩冬自烹饪学院毕业后,拒绝了城里名企的工作机会。毅然回到老家,在照顾老人的同时,开了一家只在晚上营业的大排档。凭借精湛厨艺和独特美食,吸引无数人慕名前来。而他所有的食材,全都来自一片神秘山林……',
  83. ],
  84. [
  85. 'id' => 5,
  86. 'cid' => 1,
  87. 'name' => '我是小先生',
  88. 'pic' => 'images/woshi.jpg',
  89. 'url' => 'info.php?id=5',
  90. 'author' => '九幽河上',
  91. 'summary' => '重生过去、畅想未来、梦幻现实,再塑传奇人生!',
  92. 'status' => '连载',
  93. 'sign' => '签约',
  94. 'price' => '免费',
  95. 'word' => '19.17',
  96. 'overall' => '18734',
  97. 'Weekly' => '12037',
  98. 'intro' => '张奕做了一个梦,梦见自己在一家名叫德芸社的地方学了三年相声,又拜了个小黑胖子为师,在小剧场摸爬滚打了好几年终于要开个人专场了,梦醒了……',
  99. ],
  100. [
  101. 'id' => 6,
  102. 'cid' => 1,
  103. 'name' => '海洋被我承包了',
  104. 'pic' => 'images/haiyang.jpg',
  105. 'url' => 'info.php?id=6',
  106. 'author' => '锦瑟华年',
  107. 'summary' => '重生过去、畅想未来、梦幻现实,再塑传奇人生!',
  108. 'status' => '连载',
  109. 'sign' => '签约',
  110. 'price' => '免费',
  111. 'word' => '10.17',
  112. 'overall' => '0734',
  113. 'Weekly' => '545',
  114. 'intro' => '渔家孩子夏宇开启大禹传承后,开始踏上征服大海的旅途。美丽富饶的海洋是众多海洋动物的天堂,珊瑚播撒生命的种子,座头鲸为求偶翩翩起舞,大海深处回荡着爱情的呼唤,珊瑚礁里演绎着生命的传奇,斑驳的沉船变成鱼儿的家园,神秘的海底,蕴藏着鲜活的珍宝。夏宇遨游其中,品各色海鲜、打捞沉船、追寻海盗宝藏,享受精彩纷呈的海洋生活。',
  115. ],
  116. [
  117. 'id' => 7,
  118. 'cid' => 2,
  119. 'name' => '聊斋世界修神通',
  120. 'pic' => 'images/liaozhai.jpg',
  121. 'url' => 'info.php?id=7',
  122. 'author' => '静坐讲黄庭',
  123. 'summary' => '修仙觅长生,热血任逍遥,踏莲曳波涤剑骨,凭虚御风塑圣魂!!',
  124. 'status' => '连载',
  125. 'sign' => '签约',
  126. 'price' => '免费',
  127. 'word' => '18.17',
  128. 'overall' => '11734',
  129. 'Weekly' => '545',
  130. 'intro' => '天罡三十六法,地煞七十二术,误入聊斋世界,仗剑神通无敌 。',
  131. ],
  132. [
  133. 'id' => 8,
  134. 'cid' => 2,
  135. 'name' => '万界降临',
  136. 'pic' => 'images/wanjie.jpg',
  137. 'url' => 'info.php?id=8',
  138. 'author' => '紫青都帅',
  139. 'summary' => '修仙觅长生,热血任逍遥,踏莲曳波涤剑骨,凭虚御风塑圣魂!',
  140. 'status' => '连载',
  141. 'sign' => '签约',
  142. 'price' => '免费',
  143. 'word' => '14.17',
  144. 'overall' => '6734',
  145. 'Weekly' => '1545',
  146. 'intro' => '当我们遭遇不顺的时候,盼望拥有法术让我们心想事成;当我们被人欺负时,梦想拥有超能力让敌人满地找牙;当我们遇到危险时候,期望拥有神奇力量化险为夷;当我们生病受伤时候,企盼能有灵丹妙药让人获得健康……当有一天,人类创作出来的小说、电影、游戏各个世界全都变现成真,我们获得了我们希求的力量和仙药法宝,解决了眼前的危机,但是里面的各路神仙妖魔也都纷纷降临到地球上……本书所有功法人物事件都是本人编的,全是假的!千万不要照着练,如有雷同,纯属巧合。',
  147. ],
  148. [
  149. 'id' => 9,
  150. 'cid' => 2,
  151. 'name' => '封神萧升传',
  152. 'pic' => 'images/fengshen.jpg',
  153. 'url' => 'info.php?id=9',
  154. 'author' => '玄宗小道',
  155. 'summary' => '修仙觅长生,热血任逍遥,踏莲曳波涤剑骨,凭虚御风塑圣魂!',
  156. 'status' => '连载',
  157. 'sign' => '签约',
  158. 'price' => '免费',
  159. 'word' => '17.17',
  160. 'overall' => '10734',
  161. 'Weekly' => '2545',
  162. 'intro' => '大道如川,百舸争流。不想做炮灰,那该怎么办?萧升说,既然选择不了出生,那就试图改变命运,毕竟,封神还很久……',
  163. ],
  164. [
  165. 'id' => 10,
  166. 'cid' => 2,
  167. 'name' => '九叔世界当警察',
  168. 'pic' => 'images/jiushu.jpg',
  169. 'url' => 'info.php?id=10',
  170. 'author' => '九叔粉丝小白',
  171. 'summary' => '修仙觅长生,热血任逍遥,踏莲曳波涤剑骨,凭虚御风塑圣魂!',
  172. 'status' => '连载',
  173. 'sign' => '签约',
  174. 'price' => '免费',
  175. 'word' => '19.17',
  176. 'overall' => '2734',
  177. 'Weekly' => '565',
  178. 'intro' => '方正东穿越了,成为一名民国警察。刚上任第一天,就听到了一阵熟悉的叫喊声。“快开门啊!我是你们队长阿威啊!”',
  179. ],
  180. [
  181. 'id' => 11,
  182. 'cid' => 2,
  183. 'name' => '我想长生不死',
  184. 'pic' => 'images/woxiang.jpg',
  185. 'url' => 'info.php?id=11',
  186. 'author' => '周流星位',
  187. 'summary' => '修仙觅长生,热血任逍遥,踏莲曳波涤剑骨,凭虚御风塑圣魂!',
  188. 'status' => '连载',
  189. 'sign' => '签约',
  190. 'price' => '免费',
  191. 'word' => '13.17',
  192. 'overall' => '2734',
  193. 'Weekly' => '618',
  194. 'intro' => '远古洪荒,天东有若木,钟山有赤龙衔烛,三皇与诸神称霸天地。三清尚无人听说,西方二人组也没什么消息,女娲、伏羲、太一、帝俊、十二祖巫等耳熟能详的大人物也都无人听闻。这是一个无尽古老的时代,距离道门炼气术开启仙路,才不过九万年。鸿钧还只是道尊,罗睺还只是魔皇。钟恒带着十二本“讲道笔记”来到了这样一个时代,理想不大,只想长生不死。长生易得,不死难成。如何不死?超越一切,方能不死!时代太早,劫数太多,低调修炼,苟字为先……',
  195. ],
  196. [
  197. 'id' => 12,
  198. 'cid' => 2,
  199. 'name' => '西游之绝代凶蟾',
  200. 'pic' => 'images/xiyou.jpg',
  201. 'url' => 'info.php?id=12',
  202. 'author' => '贪玩的提莫',
  203. 'summary' => '修仙觅长生,热血任逍遥,踏莲曳波涤剑骨,凭虚御风塑圣魂!',
  204. 'status' => '连载',
  205. 'sign' => '签约',
  206. 'price' => '免费',
  207. 'word' => '28.17',
  208. 'overall' => '5734',
  209. 'Weekly' => '645',
  210. 'intro' => '重生在西游世界,老子竟然成了一只蛤蟆?灵感大王是我的小跟班,七大圣是我的结拜兄弟,',
  211. ]
  212. ];

总结

  • 在静态转变动态过程中,把重复的代码交给数据循环来完成;
  • 函数实现了代码的复用,大量相同的操作可以用调用一个函数来完成;
  • 数据在网页之间跳转的参数传递,是字符串完成,在对比的时候要转换类型;
  • 在调用函数的时候,传参的数据顺序要和定义函数的时候顺序一致;
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