我必须使用implode函数将数组更新为字符串,但它无法正常工作

I have to update a query with array as a string by using implode function

  public function add_students_who_travel_by_bus(){
    $select_bus_stop = $this->input->post('select_bus_stop');
          $checkbox = $this->input->post('checkbox[]');
            if($checkbox){
                $id = implode(",",$checkbox);
                    $data = array(
                    "student_id" => '$id', 
                    );
                    $this->db->where('transport_route_time_id',$select_bus_stop);
                    $this->db->update('transport_route_time',$data); 

              return $this->session->set_flashdata('response_message', '<div class="alert alert-info">Successfully Updated !</div>');
                }else{
                    return $this->session->set_flashdata('response_message', '<div class="alert alert-danger">Data Not Found To Store !</div>');
                }
}

by 'not working properly' did you mean there is no value saved? if it's that the case, try to

var_dump($this->input->post('checkbox[]'));die();

if it's null than maybe you use wrong name? please, share the html form, so i can give a better answer..

edited :

as far i remember, to get the checkbox values in codeigniter, you dont need to use '[]'

for example let sya you have these on your form

<input type="checkbox" name="businessType[]" value="1">
<input type="checkbox" name="businessType[]" value="2">
<input type="checkbox" name="businessType[]" value="3">

all you need to get the values is to refer 'businessType' (without '[]') as name.

$data = $this->input->post('businessType');