在模板中怎么用PHP页定义的数组

2016-07-07 15:01 来源:www.chinab4c.com 作者:ecshop专家

PHP中的数组:
  1. Array (
  2. [0] => Array(
  3. [gk_sn] => 1004
  4. [group_id] => 12 )
  5. [1] => Array (
  6. [gk_sn] => 1003
  7. [group_id] => 12 )
  8. [2] => Array (
  9. [gk_sn] => 1002
  10. [group_id] => 12
  11. [3] => Array (
  12. [gk_sn] => 1008
  13. [group_id] => 13
  14. [4] => Array (
  15. [gk_sn] => 1009
  16. [group_id] => 13
  17. )
  18. )
复制代码
怎么样在模板中用foreach,达到效果:
  1. 12:1002,1003,1004
  2. 13:1008,1009
复制代码

回答:
你直接在模板里面写<?php 写PHP.然后循环?>