thinkphp5如何遍历model层的信息

后台一数组:
$this->assign('order_info',$order_info);
array(1) {
  ["order_id"] => int(659)
  ["order_sn"] => string(18) "201806122259327722"
  ["order_goods"] => array(1) {
    [0] => object(app\common\model\OrderGoods)#23 (31) {
      ["table":protected] => string(15) "store_order_goods"
      ["connection":protected] => array(0) {
      }
      ["query":protected] => NULL
      ["name":protected] => string(10) "OrderGoods"
      ["class":protected] => string(27) "app\common\model\OrderGoods"
      ["error":protected] => NULL
      ["validate":protected] => NULL
      ["pk":protected] => NULL
      ["field":protected] => array(0) {
      }
      ["readonly":protected] => array(0) {
      }
      ["visible":protected] => array(0) {
      }
      ["hidden":protected] => array(0) {
      }
      ["append":protected] => array(0) {
      }
      ["data":protected] => array(25) {
        ["rec_id"] => int(1099)
        ["order_id"] => int(659)
        ["goods_id"] => int(166)
        ["goods_name"] => string(12) "图片滚动"
        ["goods_num"] => int(1)
        
      }
      
    }
  }
  
  }
}

如上一数组,想要获取如下的信息:


如何实现呢?请往下看:

<volist name="order_info[order_goods]" id="good">

<a class="order_name">{$good.goods_name}</a>

</volist>

获取就这样,是不是很简单呢?

猜你喜欢

转载自blog.csdn.net/qq_36926807/article/details/80867654
今日推荐