function create($parentId = '') { //处理post的值 if ($this->input->post('title')) { // var_dump($_POST); $title = $this->input->post('title'); $parentId = $this->input->post('parentId'); $continuous = $this->input->post('continuous'); if (empty($parentId)) { //一级类型 $objectId = $this->model->create(array('title' => $title)); } else { //二级类型 $objectId = $this->model->create(array('title' => $title, 'parent' => avosPointer('CouponType', $parentId))); } if (empty($continuous)) { // redirect to index $this->session->set_flashdata('msg', '创建成功'); redirect('admin/coupontypes/index', 'refresh'); } } // display form $data['title'] = '新建类型'; $data['main'] = 'admin_coupontypes_create'; if (!empty($parentId)) { $data['parentId'] = $parentId; } $this->load->view($this->config->item('admin_template'), $data); }