douyinlai2169 2018-06-22 07:13
浏览 13

Cookies似乎有效,但基于的推车没有

I have a weird problem with one of my sites. I use session_id stored in a cookie for setting the current cart id in the database. I got something like this:

function getCartID(){
    if(isset($_COOKIE["cartID"]))
        return $_COOKIE["cartID"];
    else {
        $expire = time()+3600*24*30;
        $newCartID = session_id();
        setcookie("cartID",$newCartID,$expire);
        return $newCartID;
    }
}

Then I save the cart to MySQL database. It works fine, always worked fine everywhere I checked. But recently I got an info from my client that some users can't order their products (I'm not sure if it's "some" or "only one"). They add products to the cart, but when they go to cart page, the cart is empty (I have a screen capture of this happening). So it seems that they have the cookies turned off. But the cookies seem to work fine. They don't get the info that cookies should be enabled to order products and I even sent a simple sample page checking the cookies, and it's OK.

I've checked the database for copies of the same cart ids. This is the only explanation I came up with at this moment. And there are none.

Am I doing something wrong here? Is there any way to check what's going on here?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 目详情-五一模拟赛详情页
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line