Blogger Information
Blog 20
fans 0
comment 0
visits 10858
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
实例演绎php遍历数组与js遍历数组的区别
麦兜的故事
Original
445 people have browsed it

php遍历数组

  1. <h2><? echo '学生简介表单信息' ?></h2>
  2. <ol>
  3. <!-- php 模板变量 :充当前面的花括号{ endforeach充当后面的花括号} -->
  4. <?php foreach ($names as $name): ?>
  5. <li style="color:greenyellow">
  6. <a href=""><? echo $name ?></a>
  7. </li>
  8. <?endforeach?>
  9. </ol>

js遍历数组

  1. <script>
  2. let preLi = document.querySelector("li").nextElementSibling.nextElementSibling;
  3. console.log(preLi);
  4. let names = ["小米 17 小米官网","小赖 14 放弃入门","小黄 12 开始学习"];
  5. names.forEach(item => console.log(item));
  6. </script>
Correcting teacher:PHPzPHPz

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