批改状态:合格
老师批语:
<?phpreturn [['id' => 1,'title' => '最新产品1','img' => 'static/images/item1.jpeg','url'=>'https://www.php.cn'],['id' => 2,'title' => '最新产品2','img' => 'static/images/item2.jpeg','url'=>'https://www.php.cn'],['id' => 3,'title' => '最新产品3','img' => 'static/images/item3.jpeg','url'=>'https://www.php.cn'],['id' => 4,'title' => '最新产品4','img' => 'static/images/item4.jpeg','url'=>'https://www.php.cn'],['id' => 5,'title' => '最新产品5','img' => 'static/images/item5.jpeg','url'=>'https://www.php.cn'],['id' => 6,'title' => '最新产品6','img' => 'static/images/item6.jpeg','url'=>'https://www.php.cn'],['id' => 7,'title' => '最新产品7','img' => 'static/images/item7.jpeg','url'=>'https://www.php.cn'],['id' => 8,'title' => '最新产品8','img' => 'static/images/item8.jpeg','url'=>'https://www.php.cn'],];
<?php// 加载外部文件// include 'template/public/header.php'require 'template/public/header.php';$news = require 'data/news.php';$cp = require 'data/cp.php';?><!-- 主体 --><main><!-- 新闻列表 --><div class="news"><h3>新闻列表</h3><div class="list"><?php foreach ($news as $k => $v) : ?><?php if ($k == 5) {break;} ?><a href="<?=$v['url'] ?>"><?=$v['title'] ?></a><?php endforeach ?></div></div><!-- 产品列表 --><div class="items"><h3>产品列表</h3><div class="list"><?php foreach ($cp as $k => $v) : ?><?php if ($k == 4) {break;} ?><div class="item"><img src="<?= $v['img'] ?>" alt="" /><a href="<?= $v['url'] ?>"><?= $v['title'] ?></a></div><?php endforeach ?></div></div></div></main><?php// 加载外部文件include 'template/public/footer.php';?>
<?php// 加载外部文件require 'template/public/header.php';$cp = require 'data/cp.php';?><!-- 主体 --><main><!-- 产品列表 --><div class="items"><h3>产品列表</h3><div class="list"><?php foreach ($cp as $k => $v) : ?><div class="item"><img src="<?= $v['img'] ?>" alt="" /><a href="<?= $v['url'] ?>"><?= $v['title'] ?></a></div><?php endforeach ?></div></div><!-- 分页条 --><p class="pagebar"><a href="">1</a><a href="">...</a><a href="">6</a><a href="">7</a><a href="" class="active">8</a><a href="">9</a><a href="">10</a><a href="">...</a><a href="">20</a></p></main><!-- 页脚 --><?php// 加载外部文件include 'template/public/footer.php';?>


Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号