我正在開發codeigniter站點。這裏是我的控制器功能:在codeigniter站點的cookie中設置數組
public function hoteldetails($id)
{
$this->load->helper('cookie');
$hotel_details_view = array();
$hotel_details_view = get_cookie('hotel_details_view');
array_push($hotel_details_view, $id);
$this->input->set_cookie($hotel_details_view);
print_r($hotel_details_view);
$this->load->view('hotel_details',$data);
}
現在我想在功能的時間來設置cookie的多個$ ID叫
我得到的錯誤:
A PHP Error was encountered
Severity: Warning
Message: array_push() expects parameter 1 to be array, boolean given
Filename: controllers/hotel.php
Line Number: 191
我需要幫助:)
我曾經嘗試這樣做,這不是打印陣列:( –
@SharmisthaDas:答案更新 – devpro