Blogger Information
Blog 25
fans 1
comment 1
visits 17361
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0110-0112作业+PHP动态数据的实现+10期线上班
江川林
Original
587 people have browsed it

以下是实现图片


因为图片太长,就只能截图一半

我做的是手机版招聘网页
其中
-紧急招聘-做的是秒杀类
-全部招聘-和-寒暑假工-是固定内容

现在依次提交紧急招聘,全部兼职,寒暑假工这三处的关键代码

紧急招聘
-以下是图片-

-以下是关键代码-

  1. <?php
  2. //随机抽取5位键值
  3. $as = array_rand($containers , 5);
  4. foreach ($as as $a){
  5. $skills[ ] = $a;
  6. }
  7. <div class="detail">
  8. <div class="gs">
  9. <div class="title">
  10. <span>急聘兼职</span>
  11. </div>
  12. <?php foreach ($skills as $skill) :?>
  13. <div class="g">
  14. <div>
  15. <img src="<?php echo STATIC_PATH.$skill['img'] ?>" alt="">
  16. <div>
  17. <a href=""><?php echo $skill['name'] ?></a>
  18. <span>日期:2019年1月2日</span>
  19. <span>薪资:¥<?php echo $skill['price'] ?></span>
  20. </div>
  21. <section>
  22. <a href=""><span>点击报名</span></a>
  23. </section>
  24. </div>
  25. </div>
  26. <?php endforeach; ?>
  27. </div>
  28. ?>

以下是列表信息

  1. <div class="detail">
  2. <!-- 获取栏目名称-->
  3. <!-- --><?php
  4. $cid = $_GET['cid'];
  5. // 用函数封装获取栏目名称
  6. function getName($cid,$columns)
  7. {
  8. foreach ($columns as $column ){
  9. if ($column['id'] === intval($cid)){
  10. $name = $column['name'];
  11. }
  12. }
  13. return $name;
  14. }
  15. $name = getName($cid,$columns);
  16. // 用函数封装获取商品
  17. function getGoods($cid,$containers)
  18. {
  19. foreach ($containers as $container){
  20. if ($container['cid'] === intval($cid)){
  21. $names[] = $container;
  22. }
  23. }
  24. return $names;
  25. }
  26. $names = getGoods($cid,$containers);;
  27. ?>
  28. <div class="gs">
  29. <div class="title">
  30. <span><?php echo $name?></span>
  31. </div>
  32. <?php foreach ($names as $container) : ?>
  33. <div class="g">
  34. <div>
  35. <img src="<?php echo STATIC_PATH.$container['img'] ?>" alt="">
  36. <div>
  37. <a href="<?php echo $container['url']?>"><?php echo $container['name']?></a>
  38. <span>日期:2019年1月2日</span>
  39. <span>薪资:¥<?php echo $container['price'] ?></span>
  40. </div>
  41. <section>
  42. <a href=""><span>点击报名</span></a>
  43. </section>
  44. </div>
  45. </div>
  46. <?php endforeach; ?>
  47. </div>

#

-1,编辑HTML页面
-2,添加配置文件
主要是在调试的时候,逻辑一定要清晰,我是把老师教过的多写多记,因为第一次接触,之前根本都没想过这些逻辑,比较陌生

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