$item = new stdClass(); $item->goods_id = $item_goods->getID(); $item->goods_name = $item_goods->getName(); $items[] = $item;
或者
$items[$cart[0]] = $item; //定义数组名