简体   繁体   English

CodeIgniter IE无法正确存储会话

[英]CodeIgniter IE not storing sessions correctly

I am using the Cart class of CodeIgniter, basically that's just sessions. 我正在使用CodeIgniter的Cart类,基本上这只是会话。 Now, Safari is handling them perfectly fine and is doing what it is supposed to do. 现在,Safari可以很好地处理它们,并且正在执行应做的事情。 IE, on the other hand, does not store them. IE,另一方面,不存储它们。

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. Safari将一个结果添加到数据库中,并填写了所有字段。 Now IE. 现在的IE。 It adds around 5 items to the database with the row 'user_data' being empty. 它向数据库添加了大约5个项目,其中“ user_data”行为空。

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;
    }
}

I fixed it by finding a website on Google after reading through 20 pages. 在阅读20页后,我通过在Google上找到一个网站来修复它。 Fixed after changing 修改后固定

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

to

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM