2014-12-03 41 views
2

工作,我必須分配一個多頭排列的笨會話,但它不工作。如果我使用三個四元素的數組,那麼這項工作。我的數組如下。笨會話不與多頭排列

 $value['id']     = $checkout_product['checkout']['id']; 
    $value['user_id']    = $checkout_product['checkout']['user_id']; 
    $value['name']     = $checkout_product['checkout']['name']; 
    $value['maker']    = $checkout_product['checkout']['maker']; 
    $value['model']    = $checkout_product['checkout']['model']; 
    $value['color']    = $checkout_product['checkout']['color']; 
    $value['size']     = $checkout_product['checkout']['size']; 
    $value['slug']     = $checkout_product['checkout']['slug']; 
    $value['route_id']    = $checkout_product['checkout']['route_id']; 
    $value['description']   = $checkout_product['checkout']['description']; 
    $value['quantity']    = $checkout_product['checkout']['quantity']; 
    $value['p_units']    = $checkout_product['checkout']['p_units']; 
    $value['images']    = $checkout_product['checkout']['images']; 
    $value['label_type']   = $checkout_product['checkout']['label_type']; 
    $value['product_type']   = $checkout_product['checkout']['product_type']; 
    $value['auction_id']   = $checkout_product['checkout']['auction_id']; 
    $value['product_id']   = $checkout_product['checkout']['product_id']; 
    $value['budget_min']   = $checkout_product['checkout']['budget_min']; 
    $value['budget_max']   = $checkout_product['checkout']['budget_max']; 
    $value['bid_start_date']  = $checkout_product['checkout']['bid_start_date']; 
    $value['bid_end_date']   = $checkout_product['checkout']['bid_end_date']; 
    $value['status']    = $checkout_product['checkout']['status']; 
    $value['bid_id']    = $checkout_product['checkout']['bid_id']; 
    $value['bidder_id']   = $checkout_product['checkout']['bidder_id']; 
    $value['bid_product_id']  = $checkout_product['checkout']['bid_product_id']; 
    $value['bid_date']    = $checkout_product['checkout']['bid_date']; 
    $value['bid_qty']    = $checkout_product['checkout']['bid_qty']; 
    $value['bid_amount']   = $checkout_product['checkout']['bid_amount']; 
    $value['total_amount']   = $checkout_product['checkout']['total_amount']; 
    $value['payable_amount']  = $checkout_product['checkout']['payable_amount']; 
    $value['shipping_in']   = $checkout_product['checkout']['shipping_in']; 
    $value['shipping_method']  = $checkout_product['checkout']['shipping_method']; 
    $value['shipping_amount']  = $checkout_product['checkout']['shipping_amount']; 
    $value['pro_type']    = $checkout_product['checkout']['pro_type']; 
    $value['warranty_month']  = $checkout_product['checkout']['warranty_month']; 
    $value['warranty_type']  = $checkout_product['checkout']['warranty_type']; 
    $value['bid_note']    = $checkout_product['checkout']['bid_note']; 
    $value['bid_status']   = $checkout_product['checkout']['bid_status']; 
    $value['customer_id']   = $checkout_product['checkout']['customer_id']; 
    $value['customer_username'] = $checkout_product['checkout']['customer_username']; 
    $value['customer_firstname'] = $checkout_product['checkout']['customer_firstname']; 
    $value['customer_lastname'] = $checkout_product['checkout']['customer_lastname']; 
    $value['customer_email']  = $checkout_product['checkout']['customer_email']; 
    $value['customer_image']  = $checkout_product['checkout']['customer_image']; 

    $this->session->set_userdata('checkout', $value); 

此代碼不適用於我。請幫助我如何在codeigniter的會話中張貼大數組。

+0

我會使用數據庫來存儲會話:https://ellislab.com/codeigniter/user-guide/libraries/sessions.html此外,它看起來就像你正在做一個購物車。你看過CI的內置車類嗎? https://ellislab.com/codeigniter/user-guide/libraries/cart.html – versalle88 2014-12-03 13:27:42

回答

0

默認笨存儲在cookie中,其具有的尺寸取決於瀏覽器的2KB-4KB上限的會話數據。 如果您嘗試在會話中存儲超過4KB的數據,您將開始遇到問題。

最簡單的解決方法是store the session details in the DB。 Codeigniter會話文檔詳細介紹了將會話存儲在數據庫中的過程。

+1

感謝維諾德VT您有用的答案。我可以加密這種類型的數組嗎?當我嘗試加密大數組時,我已經檢查過,然後跳過一些數據。 – 2014-12-03 12:50:05

+0

@hirasingh爲什麼不seralize數組? – 2014-12-03 13:15:52

+0

@DarylGill,大陣可以分散?我認爲這會跳過一些數據...... – 2014-12-03 13:26:32