CodeIgniter IE 未正确存储会话
我正在使用 CodeIgniter 的 Cart 类,基本上这只是会话。现在,Safari 可以完美地处理它们,并且正在做它应该做的事情。另一方面,IE 不存储它们。
因此,在尝试解决此问题一段时间后,我想将会话添加到数据库中。 Safari 会向数据库添加一项结果并填写所有字段。现在是IE。它将大约 5 个项目添加到数据库中,其中“user_data”行为空。
这是将商品添加到购物车的方法;
/**
* 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 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;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
读完 20 页后,我在 Google 上找到了一个网站,解决了这个问题。
后修复
修改为
I fixed it by finding a website on Google after reading through 20 pages.
Fixed after changing
to