博客列表 >12月10号 PHP综合大作业

12月10号 PHP综合大作业

遗忘了寂寞
遗忘了寂寞原创
2019年12月15日 12:11:55723浏览

前端测试:http://njtt.wicp.net/dzy/
后端测试:http://njtt.wicp.net/dzy/admin/

数据库表
分类表

文章表

图片表

商品表

index.php

  1. <?php require 'conn.php'; ?>
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="description" content="<?= $system['desc']?>" />
  7. <meta name="keywords" content="<?= $system['key']?>" />
  8. <title>美图鉴赏——<?= $system['title'] ?></title>
  9. <link rel="stylesheet" href="static/font/iconfont.css">
  10. <link rel="stylesheet" href="static/css/image.css">
  11. </head>
  12. <body>
  13. <!--公共顶部导航区-->
  14. <?php require 'head.php'; ?>
  15. <div class="top">
  16. <h2>PHP中文网<span>图片站</span></h2>
  17. <label>
  18. <input type="search">
  19. <a href="" class="iconfont icon-jinduchaxun"></a>
  20. </label>
  21. </div>
  22. <!-- 轮播图与列表-->
  23. <div class="slider">
  24. <img src="static/images/2.jpg" alt="" width="898">
  25. <div class="list1">
  26. <h3>网页评论</h3>
  27. <ul>
  28. <li><a href="">惠若琪 |坚持热爱,活成一束光,照亮自己</a></li>
  29. <li><a href="">小米公布6400万像素手机信息 1亿像素新品</a></li>
  30. <li><a href="">富士变焦镜皇 富士16-55 f/2.8售7490元</a></li>
  31. <li><a href="">惠若琪 |坚持热爱,活成一束光,照亮自己</a></li>
  32. <li><a href="">小米公布6400万像素手机信息 1亿像素新品</a></li>
  33. <li><a href="">富士变焦镜皇 富士16-55 f/2.8售7490元</a></li>
  34. </ul>
  35. </div>
  36. </div>
  37. <div class="main">
  38. <!--图片专区1-->
  39. <div class="title">
  40. <span>图片专区1</span>
  41. </div>
  42. <div class="picture">
  43. <?php
  44. // 创建SQL语句模板
  45. $sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 2 LIMIT 3' ;
  46. // 创建SQL语句对象
  47. $stmt = $pdo->prepare($sql);
  48. // 执行SQL操作
  49. $stmt->execute();
  50. // 遍历, 返回二维数组
  51. $sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
  52. foreach($sort as $vv ):
  53. $sortID= $vv['sortID']
  54. ?>
  55. <div>
  56. <div>
  57. <a href=""><?=$vv['sortName'];?></a>
  58. <span><?=$vv['sName'];?></span>
  59. </div>
  60. <?php
  61. // 创建SQL语句模板
  62. $sql = 'SELECT a.*,b.`sortName` FROM `picture` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE a.close = 0 and a.`sortID` = :sortID LIMIT 2' ;
  63. // 创建SQL语句对象
  64. $stmt = $pdo->prepare($sql);
  65. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  66. // 执行SQL操作
  67. $stmt->execute();
  68. // 遍历, 返回二维数组
  69. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  70. foreach($article as $a_vv )
  71. {
  72. ?>
  73. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
  74. <?php } ?>
  75. <?php
  76. foreach($article as $a_vv )
  77. {
  78. ?>
  79. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
  80. <?php } ?>
  81. <?php
  82. // 创建SQL语句模板
  83. $sql = 'SELECT a.*,b.`sortName` FROM `picture` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE a.close = 0 and a.`sortID` = :sortID LIMIT 2,2' ;
  84. // 创建SQL语句对象
  85. $stmt = $pdo->prepare($sql);
  86. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  87. // 执行SQL操作
  88. $stmt->execute();
  89. // 遍历, 返回二维数组
  90. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  91. foreach($article as $a_vv )
  92. {
  93. ?>
  94. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
  95. <?php } ?>
  96. <?php
  97. foreach($article as $a_vv )
  98. {
  99. ?>
  100. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
  101. <?php } ?>
  102. </div>
  103. <?php endforeach;?>
  104. </div>
  105. <!--图片专区2-->
  106. <div class="title">
  107. <span>图片专区2</span>
  108. </div>
  109. <div class="picture">
  110. <?php
  111. // 创建SQL语句模板
  112. $sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 2 LIMIT 3,3' ;
  113. // 创建SQL语句对象
  114. $stmt = $pdo->prepare($sql);
  115. // 执行SQL操作
  116. $stmt->execute();
  117. // 遍历, 返回二维数组
  118. $sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
  119. foreach($sort as $vv ):
  120. $sortID= $vv['sortID']
  121. ?>
  122. <div>
  123. <div>
  124. <a href=""><?=$vv['sortName'];?></a>
  125. <span><?=$vv['sName'];?></span>
  126. </div>
  127. <?php
  128. // 创建SQL语句模板
  129. $sql = 'SELECT a.*,b.`sortName` FROM `picture` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE a.close = 0 and a.`sortID` = :sortID LIMIT 2' ;
  130. // 创建SQL语句对象
  131. $stmt = $pdo->prepare($sql);
  132. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  133. // 执行SQL操作
  134. $stmt->execute();
  135. // 遍历, 返回二维数组
  136. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  137. foreach($article as $a_vv )
  138. {
  139. ?>
  140. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
  141. <?php } ?>
  142. <?php
  143. foreach($article as $a_vv )
  144. {
  145. ?>
  146. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
  147. <?php } ?>
  148. <?php
  149. // 创建SQL语句模板
  150. $sql = 'SELECT a.*,b.`sortName` FROM `picture` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE a.close = 0 and a.`sortID` = :sortID LIMIT 2,2' ;
  151. // 创建SQL语句对象
  152. $stmt = $pdo->prepare($sql);
  153. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  154. // 执行SQL操作
  155. $stmt->execute();
  156. // 遍历, 返回二维数组
  157. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  158. foreach($article as $a_vv )
  159. {
  160. ?>
  161. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
  162. <?php } ?>
  163. <?php
  164. foreach($article as $a_vv )
  165. {
  166. ?>
  167. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
  168. <?php } ?>
  169. </div>
  170. <?php endforeach;?>
  171. </div>
  172. </div>
  173. <!--页底部-->
  174. <?php require 'footer.php'; ?>
  175. </body>
  176. </html>

article-list.php

  1. <?php require 'conn.php'; ?>
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="description" content="<?= $system['desc']?>" />
  7. <meta name="keywords" content="<?= $system['key']?>" />
  8. <title>新闻资讯——<?= $system['title'] ?></title>
  9. <link rel="stylesheet" href="static/font/iconfont.css">
  10. <link rel="stylesheet" href="static/css/article-list.css">
  11. </head>
  12. <body>
  13. <!--公共顶部导航区-->
  14. <?php require 'head.php'; ?>
  15. <div class="main">
  16. <div class="top">
  17. <img src="static/images/ar-logo.png" alt="">
  18. <label><input type="search"><span class="iconfont icon-sousuo2"></span></label>
  19. </div>
  20. <!-- 列表-->
  21. <article>
  22. <div>
  23. <?php
  24. $nid = trim($_GET['nid']);
  25. if(!isset($_GET['nid'])){
  26. $nid=4;
  27. }
  28. // 创建SQL语句模板
  29. $sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 1' ;
  30. // 创建SQL语句对象
  31. $stmt = $pdo->prepare($sql);
  32. // 执行SQL操作
  33. $stmt->execute();
  34. // 遍历, 返回二维数组
  35. $sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
  36. foreach($sort as $vv )
  37. {
  38. ?>
  39. <a href="article-list.php?nid=<?= $vv['sortID'];?>" <?php if($vv['sortID']==$nid){ ?> id="active"<?php } ?>><?=$vv['sortName'];?></a>
  40. <?php } ?>
  41. </div>
  42. <?php
  43. // 创建SQL语句模板
  44. $sql = 'SELECT a.*,b.`sortName` FROM `article` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE a.close = 0 and a.`sortID` = :sortID' ;
  45. // 创建SQL语句对象
  46. $stmt = $pdo->prepare($sql);
  47. $stmt->bindParam('sortID', $nid, PDO::PARAM_INT);
  48. // 执行SQL操作
  49. $stmt->execute();
  50. // 遍历, 返回二维数组
  51. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  52. foreach($article as $a_vv )
  53. {
  54. ?>
  55. <div class="list1">
  56. <a href="article.php?nid=<?= $a_vv['articleID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="272"></a>
  57. <div>
  58. <a href="article.php?nid=<?= $a_vv['articleID'];?>"><?= $a_vv['title'];?></a>
  59. <span><?= mb_substr($a_vv['content'],0,90,'utf-8');?></span>
  60. </div>
  61. <a href="article-list.php?nid=<?= $nid;?>"><?= $a_vv['sortName'];?> · 46 分钟前</a>
  62. <span><i class="iconfont icon-icon_yulan"></i>2233</span>
  63. </div>
  64. <?php } ?>
  65. </article>
  66. <!-- 右侧列表-->
  67. <?php require 'art_right.php'; ?>
  68. <!-- 推荐-->
  69. <?php require 'recommend.php'; ?>
  70. </div>
  71. <!--页底部-->
  72. <?php require 'footer.php'; ?>
  73. </body>
  74. </html>

article.php

  1. <?php require 'conn.php'; ?>
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <?php
  6. $nid = trim($_GET['nid']);
  7. // 创建SQL语句模板
  8. $sql = 'SELECT a.*,b.`sortName` FROM `article` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE articleID = :articleID' ;
  9. // 创建SQL语句对象
  10. $stmt = $pdo->prepare($sql);
  11. $stmt->bindParam('articleID', $nid, PDO::PARAM_INT);
  12. // 执行SQL操作
  13. $stmt->execute();
  14. // 遍历, 返回二维数组
  15. $article = $stmt->fetch(PDO::FETCH_ASSOC);
  16. $title=$article['title'];
  17. $sortID=$article['sortID'];
  18. $pictureURL=$article['pictureURL'];
  19. $show=$article['show'];
  20. $content=$article['content'];
  21. $sortName=$article['sortName'];
  22. ?>
  23. <meta charset="UTF-8">
  24. <meta name="description" content="<?= $system['desc']?>" />
  25. <meta name="keywords" content="<?= $system['key']?>" />
  26. <title><?= $title ?>--<?= $system['title']?></title>
  27. <link rel="stylesheet" href="static/font/iconfont.css">
  28. <link rel="stylesheet" href="static/css/article.css">
  29. </head>
  30. <body>
  31. <!--公共顶部导航区-->
  32. <?php require 'head.php'; ?>
  33. <div class="main">
  34. <div class="top">
  35. <img src="static/images/ar-logo.png" alt="">
  36. <a href="article-list.php?nid=<?= $sortID ?>"><?=$sortName ?></a>&gt;<span>正文</span>
  37. <label><input type="search"><span class="iconfont icon-sousuo2"></span></label>
  38. </div>
  39. <!-- 正文-->
  40. <article>
  41. <h1><?= $title ?></h1>
  42. <div>
  43. <span>发布时间:2019.8.8</span>
  44. <span>来源:北京 青年报</span>
  45. <span>阅读量:545</span>
  46. <span>评论数:1545</span>
  47. </div>
  48. <div>
  49. <br>
  50. <p><img src="<?=$pictureURL ?>" alt="" width="100%"></p>
  51. <br>
  52. <hr>
  53. <br>
  54. <p><?= $content ?></p>
  55. </div>
  56. </article>
  57. <!-- 右侧列表-->
  58. <?php require 'art_right.php'; ?>
  59. <!-- 推荐-->
  60. <?php require 'recommend.php'; ?>
  61. </div>
  62. <!--页底部-->
  63. <?php require 'footer.php'; ?>
  64. </body>
  65. </html>

image.php

  1. <?php require 'conn.php'; ?>
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="description" content="<?= $system['desc']?>" />
  7. <meta name="keywords" content="<?= $system['key']?>" />
  8. <title>美图鉴赏——<?= $system['title'] ?></title>
  9. <link rel="stylesheet" href="static/font/iconfont.css">
  10. <link rel="stylesheet" href="static/css/image.css">
  11. </head>
  12. <body>
  13. <!--公共顶部导航区-->
  14. <?php require 'head.php'; ?>
  15. <div class="top">
  16. <h2>PHP中文网<span>图片站</span></h2>
  17. <label>
  18. <input type="search">
  19. <a href="" class="iconfont icon-jinduchaxun"></a>
  20. </label>
  21. </div>
  22. <!-- 轮播图与列表-->
  23. <div class="slider">
  24. <img src="static/images/2.jpg" alt="" width="898">
  25. <div class="list1">
  26. <h3>网页评论</h3>
  27. <ul>
  28. <li><a href="">惠若琪 |坚持热爱,活成一束光,照亮自己</a></li>
  29. <li><a href="">小米公布6400万像素手机信息 1亿像素新品</a></li>
  30. <li><a href="">富士变焦镜皇 富士16-55 f/2.8售7490元</a></li>
  31. <li><a href="">惠若琪 |坚持热爱,活成一束光,照亮自己</a></li>
  32. <li><a href="">小米公布6400万像素手机信息 1亿像素新品</a></li>
  33. <li><a href="">富士变焦镜皇 富士16-55 f/2.8售7490元</a></li>
  34. </ul>
  35. </div>
  36. </div>
  37. <div class="main">
  38. <!--图片专区1-->
  39. <div class="title">
  40. <span>图片专区1</span>
  41. </div>
  42. <div class="picture">
  43. <?php
  44. // 创建SQL语句模板
  45. $sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 2 LIMIT 3' ;
  46. // 创建SQL语句对象
  47. $stmt = $pdo->prepare($sql);
  48. // 执行SQL操作
  49. $stmt->execute();
  50. // 遍历, 返回二维数组
  51. $sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
  52. foreach($sort as $vv ):
  53. $sortID= $vv['sortID']
  54. ?>
  55. <div>
  56. <div>
  57. <a href=""><?=$vv['sortName'];?></a>
  58. <span><?=$vv['sName'];?></span>
  59. </div>
  60. <?php
  61. // 创建SQL语句模板
  62. $sql = 'SELECT a.*,b.`sortName` FROM `picture` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE a.close = 0 and a.`sortID` = :sortID LIMIT 2' ;
  63. // 创建SQL语句对象
  64. $stmt = $pdo->prepare($sql);
  65. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  66. // 执行SQL操作
  67. $stmt->execute();
  68. // 遍历, 返回二维数组
  69. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  70. foreach($article as $a_vv )
  71. {
  72. ?>
  73. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
  74. <?php } ?>
  75. <?php
  76. foreach($article as $a_vv )
  77. {
  78. ?>
  79. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
  80. <?php } ?>
  81. <?php
  82. // 创建SQL语句模板
  83. $sql = 'SELECT a.*,b.`sortName` FROM `picture` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE a.close = 0 and a.`sortID` = :sortID LIMIT 2,2' ;
  84. // 创建SQL语句对象
  85. $stmt = $pdo->prepare($sql);
  86. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  87. // 执行SQL操作
  88. $stmt->execute();
  89. // 遍历, 返回二维数组
  90. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  91. foreach($article as $a_vv )
  92. {
  93. ?>
  94. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
  95. <?php } ?>
  96. <?php
  97. foreach($article as $a_vv )
  98. {
  99. ?>
  100. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
  101. <?php } ?>
  102. </div>
  103. <?php endforeach;?>
  104. </div>
  105. <!--图片专区2-->
  106. <div class="title">
  107. <span>图片专区2</span>
  108. </div>
  109. <div class="picture">
  110. <?php
  111. // 创建SQL语句模板
  112. $sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 2 LIMIT 3,3' ;
  113. // 创建SQL语句对象
  114. $stmt = $pdo->prepare($sql);
  115. // 执行SQL操作
  116. $stmt->execute();
  117. // 遍历, 返回二维数组
  118. $sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
  119. foreach($sort as $vv ):
  120. $sortID= $vv['sortID']
  121. ?>
  122. <div>
  123. <div>
  124. <a href=""><?=$vv['sortName'];?></a>
  125. <span><?=$vv['sName'];?></span>
  126. </div>
  127. <?php
  128. // 创建SQL语句模板
  129. $sql = 'SELECT a.*,b.`sortName` FROM `picture` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE a.close = 0 and a.`sortID` = :sortID LIMIT 2' ;
  130. // 创建SQL语句对象
  131. $stmt = $pdo->prepare($sql);
  132. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  133. // 执行SQL操作
  134. $stmt->execute();
  135. // 遍历, 返回二维数组
  136. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  137. foreach($article as $a_vv )
  138. {
  139. ?>
  140. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
  141. <?php } ?>
  142. <?php
  143. foreach($article as $a_vv )
  144. {
  145. ?>
  146. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
  147. <?php } ?>
  148. <?php
  149. // 创建SQL语句模板
  150. $sql = 'SELECT a.*,b.`sortName` FROM `picture` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE a.close = 0 and a.`sortID` = :sortID LIMIT 2,2' ;
  151. // 创建SQL语句对象
  152. $stmt = $pdo->prepare($sql);
  153. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  154. // 执行SQL操作
  155. $stmt->execute();
  156. // 遍历, 返回二维数组
  157. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  158. foreach($article as $a_vv )
  159. {
  160. ?>
  161. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
  162. <?php } ?>
  163. <?php
  164. foreach($article as $a_vv )
  165. {
  166. ?>
  167. <a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
  168. <?php } ?>
  169. </div>
  170. <?php endforeach;?>
  171. </div>
  172. </div>
  173. <!--页底部-->
  174. <?php require 'footer.php'; ?>
  175. </body>
  176. </html>

image-content.php

  1. <?php require 'conn.php'; ?>
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <?php
  6. $nid = trim($_GET['nid']);
  7. // 创建SQL语句模板
  8. $sql = 'SELECT a.*,b.`sortName` FROM `picture` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE pictureID = :pictureID' ;
  9. // 创建SQL语句对象
  10. $stmt = $pdo->prepare($sql);
  11. $stmt->bindParam('pictureID', $nid, PDO::PARAM_INT);
  12. // 执行SQL操作
  13. $stmt->execute();
  14. // 遍历, 返回二维数组
  15. $picture = $stmt->fetch(PDO::FETCH_ASSOC);
  16. $title=$picture['title'];
  17. $sortID=$picture['sortID'];
  18. $pictureURL=$picture['pictureURL'];
  19. $show=$picture['show'];
  20. $content=$picture['content'];
  21. $sortName=$picture['sortName'];
  22. ?>
  23. <meta charset="UTF-8">
  24. <meta name="description" content="<?= $system['desc']?>" />
  25. <meta name="keywords" content="<?= $system['key']?>" />
  26. <title><?= $title ?>--<?= $system['title']?></title>
  27. <link rel="stylesheet" href="static/font/iconfont.css">
  28. <link rel="stylesheet" href="static/css/image-content.css">
  29. </head>
  30. <body>
  31. <!--公共顶部导航区-->
  32. <?php require 'head.php'; ?>
  33. <div class="top">
  34. <h2>PHP中文网<span>图片站</span></h2>
  35. <label>
  36. <input type="search">
  37. <a href="" class="iconfont icon-jinduchaxun"></a>
  38. </label>
  39. </div>
  40. <div class="main">
  41. <div class="slider">
  42. <h2><?= $title ?></h2>
  43. <div class="show">
  44. <img src="<?=$pictureURL ?>" alt="" height="600">
  45. </div>
  46. <div class="thumb">
  47. <a href=""><img src="static/images/1.jpg" alt="" width="160"></a>
  48. <a href=""><img src="static/images/2.jpg" alt="" width="160"></a>
  49. <a href=""><img src="static/images/3.jpg" alt="" width="160"></a>
  50. <a href=""><img src="static/images/4.jpg" alt="" width="160"></a>
  51. <a href=""><img src="static/images/4.jpg" alt="" width="160"></a>
  52. </div>
  53. </div>
  54. <!--评论复制文章详情页代码-->
  55. <div class="comment">
  56. <h3>网页评论</h3>
  57. <img src="static/images/user.png" alt="" width="60">
  58. <textarea name="" id="" cols="30" rows="10"></textarea>
  59. <button>发表评论</button>
  60. </div>
  61. <!-- 回复复制商城详情页-->
  62. <!-- 最新评论-->
  63. <div class="reply">
  64. <h3>最新评论</h3>
  65. <div>
  66. <img src="static/images/user.png" alt="" width="60" height="60">
  67. <span>用户昵称</span>
  68. <span>留言内容</span>
  69. <div>
  70. <span>2019-12-12 15:34:23发表</span>
  71. <span><i class="iconfont icon-dianzan"></i>回复</span>
  72. </div>
  73. </div>
  74. <div>
  75. <img src="static/images/user.png" alt="" width="60" height="60">
  76. <span>用户昵称</span>
  77. <span>留言内容</span>
  78. <div>
  79. <span>2019-12-12 15:34:23发表</span>
  80. <span><i class="iconfont icon-dianzan"></i>回复</span>
  81. </div>
  82. </div>
  83. <div>
  84. <img src="static/images/user.png" alt="" width="60" height="60">
  85. <span>用户昵称</span>
  86. <span>留言内容</span>
  87. <div>
  88. <span>2019-12-12 15:34:23发表</span>
  89. <span><i class="iconfont icon-dianzan"></i>回复</span>
  90. </div>
  91. </div>
  92. <div>
  93. <img src="static/images/user.png" alt="" width="60" height="60">
  94. <span>用户昵称</span>
  95. <span>留言内容</span>
  96. <div>
  97. <span>2019-12-12 15:34:23发表</span>
  98. <span><i class="iconfont icon-dianzan"></i>回复</span>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <!--页底部-->
  104. <?php require 'footer.php'; ?>
  105. </body>
  106. </html>

shop.php

  1. <?php require 'conn.php'; ?>
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="description" content="<?= $system['desc']?>" />
  7. <meta name="keywords" content="<?= $system['key']?>" />
  8. <title>二手交易——<?= $system['title'] ?></title>
  9. <link rel="stylesheet" href="static/font/iconfont.css">
  10. <link rel="stylesheet" href="static/css/shop.css">
  11. </head>
  12. <body>
  13. <!--公共顶部导航区-->
  14. <?php require 'head.php'; ?>
  15. <!--logo+搜索框+快捷入口区-->
  16. <div class="logo">
  17. <img src="static/images/logo.png" alt="">
  18. <input type="search" id="search"><label for="search">搜索</label>
  19. <a href="">免费入驻</a>
  20. </div>
  21. <!--轮播图-->
  22. <div class="slider">
  23. <nav>
  24. <h3>所有产品分类 <span class="iconfont icon-liebiao"></span></h3>
  25. <div>
  26. <a href="">企业软件</a>
  27. <?php
  28. // 创建SQL语句模板
  29. $sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 3 LIMIT 6' ;
  30. // 创建SQL语句对象
  31. $stmt = $pdo->prepare($sql);
  32. // 执行SQL操作
  33. $stmt->execute();
  34. // 遍历, 返回二维数组
  35. $sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
  36. foreach($sort as $vv ):
  37. ?>
  38. <a href="" ><?=$vv['sortName'];?></a>
  39. <?php endforeach; ?>
  40. </div>
  41. <div>
  42. <a href="">企业软件</a>
  43. <?php
  44. foreach($sort as $vv ):
  45. ?>
  46. <a href="" ><?=$vv['sortName'];?></a>
  47. <?php endforeach; ?>
  48. </div>
  49. <div>
  50. <a href="">企业软件</a>
  51. <?php
  52. foreach($sort as $vv ):
  53. ?>
  54. <a href="" ><?=$vv['sortName'];?></a>
  55. <?php endforeach; ?>
  56. </div>
  57. </nav>
  58. <div>
  59. <div>
  60. <a href="" class="active">首页</a>
  61. <a href="">3C</a>
  62. <a href="">生活用品</a><sup class="badge"></sup>
  63. <a href="">名字名画</a>
  64. </div>
  65. <img src="static/images/4.jpg" alt="" width="900" height="398">
  66. </div>
  67. </div>
  68. <!--名画交易区-->
  69. <?php
  70. // 创建SQL语句模板
  71. $sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 3 LIMIT 1' ;
  72. // 创建SQL语句对象
  73. $stmt = $pdo->prepare($sql);
  74. // 执行SQL操作
  75. $stmt->execute();
  76. // 遍历, 返回二维数组
  77. $sort1 = $stmt->fetch(PDO::FETCH_ASSOC);
  78. $sortName = $sort1['sortName'];
  79. $sortID = $sort1['sortID'];
  80. ?>
  81. <div class="title">
  82. <span><?= $sortName ?></span>
  83. </div>
  84. <div class="second-hand">
  85. <div>
  86. <a href="">抢好货</a>
  87. <span>0低价, 便捷,安全,快速</span>
  88. </div>
  89. <div>
  90. <span>热门分类</span>
  91. <?php
  92. foreach($sort as $vv ):
  93. ?>
  94. <a href="" ><?=$vv['sortName'];?></a>
  95. <?php endforeach; ?>
  96. </div>
  97. <?php
  98. // 创建SQL语句模板
  99. $sql = 'SELECT * FROM `shop` WHERE close = 0 and `sortID` = :sortID LIMIT 4 ' ;
  100. // 创建SQL语句对象
  101. $stmt = $pdo->prepare($sql);
  102. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  103. // 执行SQL操作
  104. $stmt->execute();
  105. // 遍历, 返回二维数组
  106. $sort2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
  107. foreach($sort2 as $s_v )
  108. {
  109. ?>
  110. <a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><img src="<?= $s_v['pictureURL'];?>" alt="" width="176" height="120"></a>
  111. <?php } ?>
  112. <?php
  113. foreach($sort2 as $s_v )
  114. {
  115. ?>
  116. <div class="detail">
  117. <a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><?= $s_v['title'];?></a>
  118. <div>
  119. <a href="">
  120. <span>&yen;<?= $s_v['price'];?></span>
  121. <span><?= $sortName ?></span>
  122. </a>
  123. </div>
  124. </div>
  125. <?php } ?>
  126. <?php
  127. // 创建SQL语句模板
  128. $sql = 'SELECT * FROM `shop` WHERE close = 0 and `sortID` = :sortID LIMIT 4,4' ;
  129. // 创建SQL语句对象
  130. $stmt = $pdo->prepare($sql);
  131. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  132. // 执行SQL操作
  133. $stmt->execute();
  134. // 遍历, 返回二维数组
  135. $sort2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
  136. foreach($sort2 as $s_v )
  137. {
  138. ?>
  139. <a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><img src="<?= $s_v['pictureURL'];?>" alt="" width="176" height="120"></a>
  140. <?php } ?>
  141. <?php
  142. foreach($sort2 as $s_v )
  143. {
  144. ?>
  145. <div class="detail">
  146. <a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><?= $s_v['title'];?></a>
  147. <div>
  148. <a href="">
  149. <span>&yen;<?= $s_v['price'];?></span>
  150. <span><?= $sortName ?></span>
  151. </a>
  152. </div>
  153. </div>
  154. <?php } ?>
  155. <div>
  156. <a href=""><img src="static/images/ad/1.png" alt="" width="180" height="112"></a>
  157. <a href=""><img src="static/images/ad/2.png" alt="" width="180" height="112"></a>
  158. <a href=""><img src="static/images/ad/3.png" alt="" width="180" height="112"></a>
  159. <a href=""><img src="static/images/ad/4.png" alt="" width="180" height="112"></a>
  160. <a href=""><img src="static/images/ad/image.png" alt="" width="393" height="56"></a>
  161. <a href=""><img src="static/images/ad/ad2.jpg" alt="" width="393" height="56"></a>
  162. </div>
  163. </div>
  164. <!--写真交易区1-->
  165. <?php
  166. // 创建SQL语句模板
  167. $sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 3 LIMIT 1,2' ;
  168. // 创建SQL语句对象
  169. $stmt = $pdo->prepare($sql);
  170. // 执行SQL操作
  171. $stmt->execute();
  172. // 遍历, 返回二维数组
  173. $sort1 = $stmt->fetchAll(PDO::FETCH_ASSOC);
  174. foreach($sort1 as $s_vv )
  175. {
  176. $sortName = $s_vv['sortName'];
  177. $sortID = $s_vv['sortID'];
  178. ?>
  179. <div class="title">
  180. <span><?= $sortName ?></span>
  181. </div>
  182. <div class="mirror">
  183. <div>
  184. <a href="">抢好货</a>
  185. <span>0低价, 便捷,安全,快速</span>
  186. </div>
  187. <div>
  188. <span>热门分类</span>
  189. <?php
  190. foreach($sort as $vv ){
  191. ?>
  192. <a href="" ><?=$vv['sortName'];?></a>
  193. <?php } ?>
  194. </div>
  195. <?php
  196. // 创建SQL语句模板
  197. $sql = 'SELECT * FROM `shop` WHERE close = 0 and `sortID` = :sortID LIMIT 6' ;
  198. // 创建SQL语句对象
  199. $stmt = $pdo->prepare($sql);
  200. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  201. // 执行SQL操作
  202. $stmt->execute();
  203. // 遍历, 返回二维数组
  204. $sort2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
  205. foreach($sort2 as $s_v )
  206. {
  207. ?>
  208. <a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><img src="<?= $s_v['pictureURL'];?>" alt="" width="176" height="120"></a>
  209. <?php } ?>
  210. <?php
  211. foreach($sort2 as $s_v )
  212. {
  213. ?>
  214. <div class="detail">
  215. <a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><?= $s_v['title'];?></a>
  216. <div>
  217. <a href="">
  218. <span>&yen;<?= $s_v['price'];?></span>
  219. <span><?= $sortName ?></span>
  220. </a>
  221. </div>
  222. </div>
  223. <?php } ?>
  224. <?php
  225. // 创建SQL语句模板
  226. $sql = 'SELECT * FROM `shop` WHERE close = 0 and `sortID` = :sortID LIMIT 6,6' ;
  227. // 创建SQL语句对象
  228. $stmt = $pdo->prepare($sql);
  229. $stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
  230. // 执行SQL操作
  231. $stmt->execute();
  232. // 遍历, 返回二维数组
  233. $sort2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
  234. foreach($sort2 as $s_v )
  235. {
  236. ?>
  237. <a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><img src="<?= $s_v['pictureURL'];?>" alt="" width="176" height="120"></a>
  238. <?php } ?>
  239. <?php
  240. foreach($sort2 as $s_v )
  241. {
  242. ?>
  243. <div class="detail">
  244. <a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><?= $s_v['title'];?></a>
  245. <div>
  246. <a href="">
  247. <span>&yen;<?= $s_v['price'];?></span>
  248. <span><?= $sortName ?></span>
  249. </a>
  250. </div>
  251. </div>
  252. <?php } ?>
  253. </div>
  254. <?php } ?>
  255. <!--写真交易区2-->
  256. <!--页底部-->
  257. <?php require 'footer.php'; ?>
  258. </body>
  259. </html>

shop-content.php

  1. <?php require 'conn.php'; ?>
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <?php
  6. $nid = trim($_GET['nid']);
  7. // 创建SQL语句模板
  8. $sql = 'SELECT a.*,b.`sortName` FROM `shop` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE shopID = :shopID' ;
  9. // 创建SQL语句对象
  10. $stmt = $pdo->prepare($sql);
  11. $stmt->bindParam('shopID', $nid, PDO::PARAM_INT);
  12. // 执行SQL操作
  13. $stmt->execute();
  14. // 遍历, 返回二维数组
  15. $article = $stmt->fetch(PDO::FETCH_ASSOC);
  16. $title=$article['title'];
  17. $sortID=$article['sortID'];
  18. $pictureURL=$article['pictureURL'];
  19. $price=$article['price'];
  20. $show=$article['show'];
  21. $content=$article['content'];
  22. $sortName=$article['sortName'];
  23. ?>
  24. <meta charset="UTF-8">
  25. <meta name="description" content="<?= $system['desc']?>" />
  26. <meta name="keywords" content="<?= $system['key']?>" />
  27. <title><?= $title ?>--<?= $system['title']?></title>
  28. <link rel="stylesheet" href="static/font/iconfont.css">
  29. <link rel="stylesheet" href="static/css/shop-content.css">
  30. </head>
  31. <body>
  32. <!--公共顶部导航区-->
  33. <?php require 'head.php'; ?>
  34. <!--logo+搜索框+快捷入口区-->
  35. <div class="logo">
  36. <img src="static/images/logo.png" alt="">
  37. <input type="search" id="search"><label for="search">搜索</label>
  38. <a href="">免费入驻</a>
  39. </div>
  40. <main>
  41. <!--导航-->
  42. <nav>
  43. <h3>所有产品分类 <span class="iconfont icon-liebiao"></span></h3>
  44. <a href="shop.php" class="active">首页</a>
  45. <?php
  46. $nid = trim($_GET['nid']);
  47. if(!isset($_GET['nid'])){
  48. $nid=4;
  49. }
  50. // 创建SQL语句模板
  51. $sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 3' ;
  52. // 创建SQL语句对象
  53. $stmt = $pdo->prepare($sql);
  54. // 执行SQL操作
  55. $stmt->execute();
  56. // 遍历, 返回二维数组
  57. $sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
  58. foreach($sort as $vv )
  59. {
  60. ?>
  61. <a href="shop.php?nid=<?= $vv['sortID'];?>" ><?=$vv['sortName'];?></a>
  62. <?php } ?>
  63. </nav>
  64. <!-- 商品展示-->
  65. <div class="goods">
  66. <div class="top-nav">
  67. <a href="">首页</a>-&gt;&gt;
  68. <a href="shop.php">二手交易</a>-&gt;&gt;
  69. <a href="shop.php"><?= $sortName ?></a>-&gt;&gt;
  70. </div>
  71. <img src="<?= $pictureURL ?>" alt="">
  72. <h2><?= $title ?></h2>
  73. <p>本站特惠: <span>&yen;<?= $price ?></span></p>
  74. <p>
  75. 销量: <span>13</span>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
  76. 累积评价: <span>3</span>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
  77. 好评率: <span>199%</span>
  78. </p>
  79. <p>
  80. <label for="num">购买数量:</label><input type="number" id="num" value="1">
  81. </p>
  82. <div>
  83. <button>立即购买</button>
  84. <button><i class="iconfont icon-icon_tianjia"></i>加入购物车</button>
  85. </div>
  86. <div>
  87. <span><i class="iconfont icon-zhanghaoquanxianguanli"></i>本站保障</span>
  88. <span><i class="iconfont icon-icon_safety"></i>企业认证</span>
  89. <span><i class="iconfont icon-tianshenpi"></i>退款承诺</span>
  90. <span><i class="iconfont icon-kuaisubianpai"></i>免费换货</span>
  91. </div>
  92. </div>
  93. <!-- 商品详情-->
  94. <div class="detail">
  95. <aside>
  96. <div><span>商品详情</span><span>案例演示</span></div>
  97. <?php
  98. // 创建SQL语句模板
  99. $sql = 'SELECT * FROM `shop` WHERE close = 0 and `show` = 1 LIMIT 7' ;
  100. // 创建SQL语句对象
  101. $stmt = $pdo->prepare($sql);
  102. // 执行SQL操作
  103. $stmt->execute();
  104. // 遍历, 返回二维数组
  105. $sort2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
  106. foreach($sort2 as $s_v )
  107. {
  108. ?>
  109. <div>
  110. <a href="shop-content.php?nid=<?= $s_v['shopID'] ?>"><img src="<?= $s_v['pictureURL'] ?>" alt=""></a>
  111. <a href=""><?= $s_v['title'] ?></a>
  112. <div><span>热销:11</span><span>&yen;<?= $s_v['price'] ?></span></div>
  113. </div>
  114. <?php } ?>
  115. </aside>
  116. <article>
  117. <div class="nav">
  118. <a href="">商品详情</a>
  119. <a href="">案例/演示</a>
  120. <a href="">常见问题</a>
  121. <a href="">累计评价</a>
  122. <a href="">产品咨询</a>
  123. </div>
  124. <div class="content">
  125. <br>
  126. <p><img src="<?=$pictureURL ?>" alt="" width="100%"></p>
  127. <br>
  128. <hr>
  129. <br>
  130. <p><?= $content ?></p>
  131. </div>
  132. <div class="comment">
  133. <h3>网页评论</h3>
  134. <img src="static/images/user.png" alt="" width="60">
  135. <textarea name="" id="" cols="30" rows="10"></textarea>
  136. <button>发表评论</button>
  137. </div>
  138. <!-- 最新评论-->
  139. <div>
  140. <h3>最新评论</h3>
  141. <div>
  142. <img src="static/images/user.png" alt="" width="60" height="60">
  143. <span>用户昵称</span>
  144. <span>留言内容</span>
  145. <div>
  146. <span>2019-12-12 15:34:23发表</span>
  147. <span><i class="iconfont icon-dianzan"></i>回复</span>
  148. </div>
  149. </div>
  150. <div>
  151. <img src="static/images/user.png" alt="" width="60" height="60">
  152. <span>用户昵称</span>
  153. <span>留言内容</span>
  154. <div>
  155. <span>2019-12-12 15:34:23发表</span>
  156. <span><i class="iconfont icon-dianzan"></i>回复</span>
  157. </div>
  158. </div>
  159. <div>
  160. <img src="static/images/user.png" alt="" width="60" height="60">
  161. <span>用户昵称</span>
  162. <span>留言内容</span>
  163. <div>
  164. <span>2019-12-12 15:34:23发表</span>
  165. <span><i class="iconfont icon-dianzan"></i>回复</span>
  166. </div>
  167. </div>
  168. <div>
  169. <img src="static/images/user.png" alt="" width="60" height="60">
  170. <span>用户昵称</span>
  171. <span>留言内容</span>
  172. <div>
  173. <span>2019-12-12 15:34:23发表</span>
  174. <span><i class="iconfont icon-dianzan"></i>回复</span>
  175. </div>
  176. </div>
  177. </div>
  178. </article>
  179. </div>
  180. </main>
  181. <!--页底部-->
  182. <?php require 'footer.php'; ?>
  183. </body>
  184. </html>

后台操作演示

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议