Blogger Information
Blog 12
fans 0
comment 0
visits 6607
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php遍历数组与js遍历数组的区别
Giesen?
Original
557 people have browsed it

PHP中的遍历语法模板

  1. <?php $cars = ['宝马3GT xDrive 330li 耀石灰', '宝马X5 xDrive30i x', '宝马750li xdrive v8 M'];?>
  2. <? foreach ( $cars as $a ):?>
  3. <li style = 'color:red'>
  4. <a href = ''><? echo $a?></a>
  5. </li>
  6. <?endforeach?>

js 中的遍历 数组方法

  1. <script type = 'text/javascript'>
  2. let cars = ['宝马3GT xDrive 330li 耀石灰', '宝马X5 xDrive30i x', '宝马750li xdrive v8 M'];
  3. // for ( let i = 0; i < cars.length; i++ ) {
  4. // alert( cars[i] );
  5. // }
  6. let li = document.createElement("li");
  7. let a = cars.forEach((a,b) => alert(a));
  8. </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