Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:完全超出我的预期, 写是实在是太棒了....
不过, 你提供的预览网站, 速度实在感人, 抽完一支烟才打开, 哈哈
前端测试:http://njtt.wicp.net/dzy/
后端测试:http://njtt.wicp.net/dzy/admin/
数据库表
分类表
文章表
图片表
商品表
index.php
<?php require 'conn.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="<?= $system['desc']?>" />
<meta name="keywords" content="<?= $system['key']?>" />
<title>美图鉴赏——<?= $system['title'] ?></title>
<link rel="stylesheet" href="static/font/iconfont.css">
<link rel="stylesheet" href="static/css/image.css">
</head>
<body>
<!--公共顶部导航区-->
<?php require 'head.php'; ?>
<div class="top">
<h2>PHP中文网<span>图片站</span></h2>
<label>
<input type="search">
<a href="" class="iconfont icon-jinduchaxun"></a>
</label>
</div>
<!-- 轮播图与列表-->
<div class="slider">
<img src="static/images/2.jpg" alt="" width="898">
<div class="list1">
<h3>网页评论</h3>
<ul>
<li><a href="">惠若琪 |坚持热爱,活成一束光,照亮自己</a></li>
<li><a href="">小米公布6400万像素手机信息 1亿像素新品</a></li>
<li><a href="">富士变焦镜皇 富士16-55 f/2.8售7490元</a></li>
<li><a href="">惠若琪 |坚持热爱,活成一束光,照亮自己</a></li>
<li><a href="">小米公布6400万像素手机信息 1亿像素新品</a></li>
<li><a href="">富士变焦镜皇 富士16-55 f/2.8售7490元</a></li>
</ul>
</div>
</div>
<div class="main">
<!--图片专区1-->
<div class="title">
<span>图片专区1</span>
</div>
<div class="picture">
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 2 LIMIT 3' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort as $vv ):
$sortID= $vv['sortID']
?>
<div>
<div>
<a href=""><?=$vv['sortName'];?></a>
<span><?=$vv['sName'];?></span>
</div>
<?php
// 创建SQL语句模板
$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' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$article = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
<?php } ?>
<?php
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
<?php } ?>
<?php
// 创建SQL语句模板
$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' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$article = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
<?php } ?>
<?php
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
<?php } ?>
</div>
<?php endforeach;?>
</div>
<!--图片专区2-->
<div class="title">
<span>图片专区2</span>
</div>
<div class="picture">
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 2 LIMIT 3,3' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort as $vv ):
$sortID= $vv['sortID']
?>
<div>
<div>
<a href=""><?=$vv['sortName'];?></a>
<span><?=$vv['sName'];?></span>
</div>
<?php
// 创建SQL语句模板
$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' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$article = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
<?php } ?>
<?php
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
<?php } ?>
<?php
// 创建SQL语句模板
$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' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$article = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
<?php } ?>
<?php
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
<?php } ?>
</div>
<?php endforeach;?>
</div>
</div>
<!--页底部-->
<?php require 'footer.php'; ?>
</body>
</html>
article-list.php
<?php require 'conn.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="<?= $system['desc']?>" />
<meta name="keywords" content="<?= $system['key']?>" />
<title>新闻资讯——<?= $system['title'] ?></title>
<link rel="stylesheet" href="static/font/iconfont.css">
<link rel="stylesheet" href="static/css/article-list.css">
</head>
<body>
<!--公共顶部导航区-->
<?php require 'head.php'; ?>
<div class="main">
<div class="top">
<img src="static/images/ar-logo.png" alt="">
<label><input type="search"><span class="iconfont icon-sousuo2"></span></label>
</div>
<!-- 列表-->
<article>
<div>
<?php
$nid = trim($_GET['nid']);
if(!isset($_GET['nid'])){
$nid=4;
}
// 创建SQL语句模板
$sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 1' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort as $vv )
{
?>
<a href="article-list.php?nid=<?= $vv['sortID'];?>" <?php if($vv['sortID']==$nid){ ?> id="active"<?php } ?>><?=$vv['sortName'];?></a>
<?php } ?>
</div>
<?php
// 创建SQL语句模板
$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' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $nid, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$article = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($article as $a_vv )
{
?>
<div class="list1">
<a href="article.php?nid=<?= $a_vv['articleID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="272"></a>
<div>
<a href="article.php?nid=<?= $a_vv['articleID'];?>"><?= $a_vv['title'];?></a>
<span><?= mb_substr($a_vv['content'],0,90,'utf-8');?></span>
</div>
<a href="article-list.php?nid=<?= $nid;?>"><?= $a_vv['sortName'];?> · 46 分钟前</a>
<span><i class="iconfont icon-icon_yulan"></i>2233</span>
</div>
<?php } ?>
</article>
<!-- 右侧列表-->
<?php require 'art_right.php'; ?>
<!-- 推荐-->
<?php require 'recommend.php'; ?>
</div>
<!--页底部-->
<?php require 'footer.php'; ?>
</body>
</html>
article.php
<?php require 'conn.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php
$nid = trim($_GET['nid']);
// 创建SQL语句模板
$sql = 'SELECT a.*,b.`sortName` FROM `article` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE articleID = :articleID' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('articleID', $nid, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$article = $stmt->fetch(PDO::FETCH_ASSOC);
$title=$article['title'];
$sortID=$article['sortID'];
$pictureURL=$article['pictureURL'];
$show=$article['show'];
$content=$article['content'];
$sortName=$article['sortName'];
?>
<meta charset="UTF-8">
<meta name="description" content="<?= $system['desc']?>" />
<meta name="keywords" content="<?= $system['key']?>" />
<title><?= $title ?>--<?= $system['title']?></title>
<link rel="stylesheet" href="static/font/iconfont.css">
<link rel="stylesheet" href="static/css/article.css">
</head>
<body>
<!--公共顶部导航区-->
<?php require 'head.php'; ?>
<div class="main">
<div class="top">
<img src="static/images/ar-logo.png" alt="">
<a href="article-list.php?nid=<?= $sortID ?>"><?=$sortName ?></a>><span>正文</span>
<label><input type="search"><span class="iconfont icon-sousuo2"></span></label>
</div>
<!-- 正文-->
<article>
<h1><?= $title ?></h1>
<div>
<span>发布时间:2019.8.8</span>
<span>来源:北京 青年报</span>
<span>阅读量:545</span>
<span>评论数:1545</span>
</div>
<div>
<br>
<p><img src="<?=$pictureURL ?>" alt="" width="100%"></p>
<br>
<hr>
<br>
<p><?= $content ?></p>
</div>
</article>
<!-- 右侧列表-->
<?php require 'art_right.php'; ?>
<!-- 推荐-->
<?php require 'recommend.php'; ?>
</div>
<!--页底部-->
<?php require 'footer.php'; ?>
</body>
</html>
image.php
<?php require 'conn.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="<?= $system['desc']?>" />
<meta name="keywords" content="<?= $system['key']?>" />
<title>美图鉴赏——<?= $system['title'] ?></title>
<link rel="stylesheet" href="static/font/iconfont.css">
<link rel="stylesheet" href="static/css/image.css">
</head>
<body>
<!--公共顶部导航区-->
<?php require 'head.php'; ?>
<div class="top">
<h2>PHP中文网<span>图片站</span></h2>
<label>
<input type="search">
<a href="" class="iconfont icon-jinduchaxun"></a>
</label>
</div>
<!-- 轮播图与列表-->
<div class="slider">
<img src="static/images/2.jpg" alt="" width="898">
<div class="list1">
<h3>网页评论</h3>
<ul>
<li><a href="">惠若琪 |坚持热爱,活成一束光,照亮自己</a></li>
<li><a href="">小米公布6400万像素手机信息 1亿像素新品</a></li>
<li><a href="">富士变焦镜皇 富士16-55 f/2.8售7490元</a></li>
<li><a href="">惠若琪 |坚持热爱,活成一束光,照亮自己</a></li>
<li><a href="">小米公布6400万像素手机信息 1亿像素新品</a></li>
<li><a href="">富士变焦镜皇 富士16-55 f/2.8售7490元</a></li>
</ul>
</div>
</div>
<div class="main">
<!--图片专区1-->
<div class="title">
<span>图片专区1</span>
</div>
<div class="picture">
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 2 LIMIT 3' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort as $vv ):
$sortID= $vv['sortID']
?>
<div>
<div>
<a href=""><?=$vv['sortName'];?></a>
<span><?=$vv['sName'];?></span>
</div>
<?php
// 创建SQL语句模板
$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' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$article = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
<?php } ?>
<?php
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
<?php } ?>
<?php
// 创建SQL语句模板
$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' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$article = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
<?php } ?>
<?php
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
<?php } ?>
</div>
<?php endforeach;?>
</div>
<!--图片专区2-->
<div class="title">
<span>图片专区2</span>
</div>
<div class="picture">
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 2 LIMIT 3,3' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort as $vv ):
$sortID= $vv['sortID']
?>
<div>
<div>
<a href=""><?=$vv['sortName'];?></a>
<span><?=$vv['sName'];?></span>
</div>
<?php
// 创建SQL语句模板
$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' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$article = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
<?php } ?>
<?php
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
<?php } ?>
<?php
// 创建SQL语句模板
$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' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$article = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><img src="<?= $a_vv['pictureURL'];?>" alt="" width="162" height="122"></a>
<?php } ?>
<?php
foreach($article as $a_vv )
{
?>
<a href="image-content.php?nid=<?= $a_vv['pictureID'];?>"><span><?= $a_vv['title'];?></span></a>
<?php } ?>
</div>
<?php endforeach;?>
</div>
</div>
<!--页底部-->
<?php require 'footer.php'; ?>
</body>
</html>
image-content.php
<?php require 'conn.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php
$nid = trim($_GET['nid']);
// 创建SQL语句模板
$sql = 'SELECT a.*,b.`sortName` FROM `picture` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE pictureID = :pictureID' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('pictureID', $nid, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$picture = $stmt->fetch(PDO::FETCH_ASSOC);
$title=$picture['title'];
$sortID=$picture['sortID'];
$pictureURL=$picture['pictureURL'];
$show=$picture['show'];
$content=$picture['content'];
$sortName=$picture['sortName'];
?>
<meta charset="UTF-8">
<meta name="description" content="<?= $system['desc']?>" />
<meta name="keywords" content="<?= $system['key']?>" />
<title><?= $title ?>--<?= $system['title']?></title>
<link rel="stylesheet" href="static/font/iconfont.css">
<link rel="stylesheet" href="static/css/image-content.css">
</head>
<body>
<!--公共顶部导航区-->
<?php require 'head.php'; ?>
<div class="top">
<h2>PHP中文网<span>图片站</span></h2>
<label>
<input type="search">
<a href="" class="iconfont icon-jinduchaxun"></a>
</label>
</div>
<div class="main">
<div class="slider">
<h2><?= $title ?></h2>
<div class="show">
<img src="<?=$pictureURL ?>" alt="" height="600">
</div>
<div class="thumb">
<a href=""><img src="static/images/1.jpg" alt="" width="160"></a>
<a href=""><img src="static/images/2.jpg" alt="" width="160"></a>
<a href=""><img src="static/images/3.jpg" alt="" width="160"></a>
<a href=""><img src="static/images/4.jpg" alt="" width="160"></a>
<a href=""><img src="static/images/4.jpg" alt="" width="160"></a>
</div>
</div>
<!--评论复制文章详情页代码-->
<div class="comment">
<h3>网页评论</h3>
<img src="static/images/user.png" alt="" width="60">
<textarea name="" id="" cols="30" rows="10"></textarea>
<button>发表评论</button>
</div>
<!-- 回复复制商城详情页-->
<!-- 最新评论-->
<div class="reply">
<h3>最新评论</h3>
<div>
<img src="static/images/user.png" alt="" width="60" height="60">
<span>用户昵称</span>
<span>留言内容</span>
<div>
<span>2019-12-12 15:34:23发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
<div>
<img src="static/images/user.png" alt="" width="60" height="60">
<span>用户昵称</span>
<span>留言内容</span>
<div>
<span>2019-12-12 15:34:23发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
<div>
<img src="static/images/user.png" alt="" width="60" height="60">
<span>用户昵称</span>
<span>留言内容</span>
<div>
<span>2019-12-12 15:34:23发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
<div>
<img src="static/images/user.png" alt="" width="60" height="60">
<span>用户昵称</span>
<span>留言内容</span>
<div>
<span>2019-12-12 15:34:23发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
</div>
</div>
<!--页底部-->
<?php require 'footer.php'; ?>
</body>
</html>
shop.php
<?php require 'conn.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="<?= $system['desc']?>" />
<meta name="keywords" content="<?= $system['key']?>" />
<title>二手交易——<?= $system['title'] ?></title>
<link rel="stylesheet" href="static/font/iconfont.css">
<link rel="stylesheet" href="static/css/shop.css">
</head>
<body>
<!--公共顶部导航区-->
<?php require 'head.php'; ?>
<!--logo+搜索框+快捷入口区-->
<div class="logo">
<img src="static/images/logo.png" alt="">
<input type="search" id="search"><label for="search">搜索</label>
<a href="">免费入驻</a>
</div>
<!--轮播图-->
<div class="slider">
<nav>
<h3>所有产品分类 <span class="iconfont icon-liebiao"></span></h3>
<div>
<a href="">企业软件</a>
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 3 LIMIT 6' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort as $vv ):
?>
<a href="" ><?=$vv['sortName'];?></a>
<?php endforeach; ?>
</div>
<div>
<a href="">企业软件</a>
<?php
foreach($sort as $vv ):
?>
<a href="" ><?=$vv['sortName'];?></a>
<?php endforeach; ?>
</div>
<div>
<a href="">企业软件</a>
<?php
foreach($sort as $vv ):
?>
<a href="" ><?=$vv['sortName'];?></a>
<?php endforeach; ?>
</div>
</nav>
<div>
<div>
<a href="" class="active">首页</a>
<a href="">3C</a>
<a href="">生活用品</a><sup class="badge">新</sup>
<a href="">名字名画</a>
</div>
<img src="static/images/4.jpg" alt="" width="900" height="398">
</div>
</div>
<!--名画交易区-->
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 3 LIMIT 1' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort1 = $stmt->fetch(PDO::FETCH_ASSOC);
$sortName = $sort1['sortName'];
$sortID = $sort1['sortID'];
?>
<div class="title">
<span><?= $sortName ?></span>
</div>
<div class="second-hand">
<div>
<a href="">抢好货</a>
<span>0低价, 便捷,安全,快速</span>
</div>
<div>
<span>热门分类</span>
<?php
foreach($sort as $vv ):
?>
<a href="" ><?=$vv['sortName'];?></a>
<?php endforeach; ?>
</div>
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `shop` WHERE close = 0 and `sortID` = :sortID LIMIT 4 ' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort2 as $s_v )
{
?>
<a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><img src="<?= $s_v['pictureURL'];?>" alt="" width="176" height="120"></a>
<?php } ?>
<?php
foreach($sort2 as $s_v )
{
?>
<div class="detail">
<a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><?= $s_v['title'];?></a>
<div>
<a href="">
<span>¥<?= $s_v['price'];?></span>
<span><?= $sortName ?></span>
</a>
</div>
</div>
<?php } ?>
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `shop` WHERE close = 0 and `sortID` = :sortID LIMIT 4,4' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort2 as $s_v )
{
?>
<a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><img src="<?= $s_v['pictureURL'];?>" alt="" width="176" height="120"></a>
<?php } ?>
<?php
foreach($sort2 as $s_v )
{
?>
<div class="detail">
<a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><?= $s_v['title'];?></a>
<div>
<a href="">
<span>¥<?= $s_v['price'];?></span>
<span><?= $sortName ?></span>
</a>
</div>
</div>
<?php } ?>
<div>
<a href=""><img src="static/images/ad/1.png" alt="" width="180" height="112"></a>
<a href=""><img src="static/images/ad/2.png" alt="" width="180" height="112"></a>
<a href=""><img src="static/images/ad/3.png" alt="" width="180" height="112"></a>
<a href=""><img src="static/images/ad/4.png" alt="" width="180" height="112"></a>
<a href=""><img src="static/images/ad/image.png" alt="" width="393" height="56"></a>
<a href=""><img src="static/images/ad/ad2.jpg" alt="" width="393" height="56"></a>
</div>
</div>
<!--写真交易区1-->
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 3 LIMIT 1,2' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort1 = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort1 as $s_vv )
{
$sortName = $s_vv['sortName'];
$sortID = $s_vv['sortID'];
?>
<div class="title">
<span><?= $sortName ?></span>
</div>
<div class="mirror">
<div>
<a href="">抢好货</a>
<span>0低价, 便捷,安全,快速</span>
</div>
<div>
<span>热门分类</span>
<?php
foreach($sort as $vv ){
?>
<a href="" ><?=$vv['sortName'];?></a>
<?php } ?>
</div>
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `shop` WHERE close = 0 and `sortID` = :sortID LIMIT 6' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort2 as $s_v )
{
?>
<a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><img src="<?= $s_v['pictureURL'];?>" alt="" width="176" height="120"></a>
<?php } ?>
<?php
foreach($sort2 as $s_v )
{
?>
<div class="detail">
<a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><?= $s_v['title'];?></a>
<div>
<a href="">
<span>¥<?= $s_v['price'];?></span>
<span><?= $sortName ?></span>
</a>
</div>
</div>
<?php } ?>
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `shop` WHERE close = 0 and `sortID` = :sortID LIMIT 6,6' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('sortID', $sortID, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort2 as $s_v )
{
?>
<a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><img src="<?= $s_v['pictureURL'];?>" alt="" width="176" height="120"></a>
<?php } ?>
<?php
foreach($sort2 as $s_v )
{
?>
<div class="detail">
<a href="shop-content.php?nid=<?= $s_v['shopID'];?>"><?= $s_v['title'];?></a>
<div>
<a href="">
<span>¥<?= $s_v['price'];?></span>
<span><?= $sortName ?></span>
</a>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
<!--写真交易区2-->
<!--页底部-->
<?php require 'footer.php'; ?>
</body>
</html>
shop-content.php
<?php require 'conn.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php
$nid = trim($_GET['nid']);
// 创建SQL语句模板
$sql = 'SELECT a.*,b.`sortName` FROM `shop` AS a INNER JOIN `sort` AS b ON a.`sortID`=b.`sortID` WHERE shopID = :shopID' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
$stmt->bindParam('shopID', $nid, PDO::PARAM_INT);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$article = $stmt->fetch(PDO::FETCH_ASSOC);
$title=$article['title'];
$sortID=$article['sortID'];
$pictureURL=$article['pictureURL'];
$price=$article['price'];
$show=$article['show'];
$content=$article['content'];
$sortName=$article['sortName'];
?>
<meta charset="UTF-8">
<meta name="description" content="<?= $system['desc']?>" />
<meta name="keywords" content="<?= $system['key']?>" />
<title><?= $title ?>--<?= $system['title']?></title>
<link rel="stylesheet" href="static/font/iconfont.css">
<link rel="stylesheet" href="static/css/shop-content.css">
</head>
<body>
<!--公共顶部导航区-->
<?php require 'head.php'; ?>
<!--logo+搜索框+快捷入口区-->
<div class="logo">
<img src="static/images/logo.png" alt="">
<input type="search" id="search"><label for="search">搜索</label>
<a href="">免费入驻</a>
</div>
<main>
<!--导航-->
<nav>
<h3>所有产品分类 <span class="iconfont icon-liebiao"></span></h3>
<a href="shop.php" class="active">首页</a>
<?php
$nid = trim($_GET['nid']);
if(!isset($_GET['nid'])){
$nid=4;
}
// 创建SQL语句模板
$sql = 'SELECT * FROM `sort` WHERE close = 0 and `ParentID` = 3' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort as $vv )
{
?>
<a href="shop.php?nid=<?= $vv['sortID'];?>" ><?=$vv['sortName'];?></a>
<?php } ?>
</nav>
<!-- 商品展示-->
<div class="goods">
<div class="top-nav">
<a href="">首页</a>->>
<a href="shop.php">二手交易</a>->>
<a href="shop.php"><?= $sortName ?></a>->>
</div>
<img src="<?= $pictureURL ?>" alt="">
<h2><?= $title ?></h2>
<p>本站特惠: <span>¥<?= $price ?></span></p>
<p>
销量: <span>13</span> |
累积评价: <span>3</span> |
好评率: <span>199%</span>
</p>
<p>
<label for="num">购买数量:</label><input type="number" id="num" value="1">
</p>
<div>
<button>立即购买</button>
<button><i class="iconfont icon-icon_tianjia"></i>加入购物车</button>
</div>
<div>
<span><i class="iconfont icon-zhanghaoquanxianguanli"></i>本站保障</span>
<span><i class="iconfont icon-icon_safety"></i>企业认证</span>
<span><i class="iconfont icon-tianshenpi"></i>退款承诺</span>
<span><i class="iconfont icon-kuaisubianpai"></i>免费换货</span>
</div>
</div>
<!-- 商品详情-->
<div class="detail">
<aside>
<div><span>商品详情</span><span>案例演示</span></div>
<?php
// 创建SQL语句模板
$sql = 'SELECT * FROM `shop` WHERE close = 0 and `show` = 1 LIMIT 7' ;
// 创建SQL语句对象
$stmt = $pdo->prepare($sql);
// 执行SQL操作
$stmt->execute();
// 遍历, 返回二维数组
$sort2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($sort2 as $s_v )
{
?>
<div>
<a href="shop-content.php?nid=<?= $s_v['shopID'] ?>"><img src="<?= $s_v['pictureURL'] ?>" alt=""></a>
<a href=""><?= $s_v['title'] ?></a>
<div><span>热销:11</span><span>¥<?= $s_v['price'] ?></span></div>
</div>
<?php } ?>
</aside>
<article>
<div class="nav">
<a href="">商品详情</a>
<a href="">案例/演示</a>
<a href="">常见问题</a>
<a href="">累计评价</a>
<a href="">产品咨询</a>
</div>
<div class="content">
<br>
<p><img src="<?=$pictureURL ?>" alt="" width="100%"></p>
<br>
<hr>
<br>
<p><?= $content ?></p>
</div>
<div class="comment">
<h3>网页评论</h3>
<img src="static/images/user.png" alt="" width="60">
<textarea name="" id="" cols="30" rows="10"></textarea>
<button>发表评论</button>
</div>
<!-- 最新评论-->
<div>
<h3>最新评论</h3>
<div>
<img src="static/images/user.png" alt="" width="60" height="60">
<span>用户昵称</span>
<span>留言内容</span>
<div>
<span>2019-12-12 15:34:23发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
<div>
<img src="static/images/user.png" alt="" width="60" height="60">
<span>用户昵称</span>
<span>留言内容</span>
<div>
<span>2019-12-12 15:34:23发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
<div>
<img src="static/images/user.png" alt="" width="60" height="60">
<span>用户昵称</span>
<span>留言内容</span>
<div>
<span>2019-12-12 15:34:23发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
<div>
<img src="static/images/user.png" alt="" width="60" height="60">
<span>用户昵称</span>
<span>留言内容</span>
<div>
<span>2019-12-12 15:34:23发表</span>
<span><i class="iconfont icon-dianzan"></i>回复</span>
</div>
</div>
</div>
</article>
</div>
</main>
<!--页底部-->
<?php require 'footer.php'; ?>
</body>
</html>
后台操作演示