Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

php - CodeIgniter IE not storing sessions correctly

I am using the Cart class of CodeIgniter, basically that's just sessions. Now, Safari is handling them perfectly fine and is doing what it is supposed to do. IE, on the other hand, does not store them.

So after a while of trying to fix this, I figured to add the sessions to the database. Safari adds one result to the database with all fields filled out. Now IE. It adds around 5 items to the database with the row 'user_data' being empty.

This is the method adding the item to the cart;

    /**
* Method to add an item to the shopping cart.
*
* @access public
* @param integer $product_id
* @param string $name
* @param string $name_clean
* @param string $image
* @param integer $price
* @return boolean
* @since v0.1.0.0
*/
public function insert_item_cart($product_id='1',$name='default',$name_clean='default',$image='default',$price=1.00)
{
    // Prepare the data to be added to the cart.
    $data = array(
        'id'            => $product_id,
        'qty'           => 1,
        'name'          => $name,
        'price'         => $price,
        'options'       => array('name_clean' => $name_clean,'image' => $image)
    );

    // Insert the item to the cart.
    if ($this->cart->insert($data))
    {
        return true;
    }
    else
    {
        return false;
    }
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I fixed it by finding a website on Google after reading through 20 pages. Fixed after changing

$config['sess_cookie_name']     = 'ci_session';

to

$config['sess_cookie_name']     = 'cisession';

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...