视图:
的index.php / multiple_w / multiple_data"方法="后" ENCTYPE ="多部分/格式数据"> 名称控制器:
class multiple_w扩展CI_Controller {
public function index(){
$this->load->view('multiple');
}
public function multiple_data(){
$this->load->model("multiple_m");
$this->multiple_m->mult_data();
}
模型:
class multiple_m扩展了CI_Model {
public function mult_data(){
$name = $this->input->post('name');
$mul_array = $this->input->post('multiple');
//converting array into a string
$mul_val_string = serialize($mul_array);
// $data = array();
$data = array(
'name' => $name,
'multiple_id' => $mul_val_string,
);
$this->db->insert('multi_table', $data);
if ($this->db->affected_rows() > 1) {
return true;
} else {
return false;
}
}
}
输出: 一个:3:{I 0,S:1:"&#34 ;; I:1; S:1:" B&#34 ;; I:2; S:1:&#34 ; C&#34 ;;}