Controller:
$sid = $this->uri->segment(4);
$serial = $this->contract_items->get_all_serial($id);
$_items = array();
foreach ($serial as $k => $v) {
$oldserial = $this->contract_items->get_childrens($sid);
$_items[$v->contract_id] = array("children" => $oldserial);
}
$this->data['serial_items'] = $_items;
$this->build_view("contracts/serial.php");
这是我 print_r() 时的输出,我希望它在我看来打印“FDO1643R26G”和“FDO1643R26G”。
Array ( [0] => Array ( [children] => Array ( [0] => stdClass Object ( [serial_num] => FDO1643R26G-XXX ) [1] => stdClass Object ( [serial_num] => FDO1643R26G-XXX-XXX ) ) ) )