Update value in session array php

前端 未结 3 1531
小鲜肉
小鲜肉 2021-01-07 14:33

I have question about the SESSION array.

I just add item and qty in different session. I use code like this :

$_SESSION[\'idproduct\'] = $id.\",\";         


        
3条回答
  •  醉酒成梦
    2021-01-07 15:17

    You could use explode function and push another item into the array

    $items = explode($_SESSION['idproduct']);
    $items[] = $your_new_value;
    print_r($items); // this will you the values inside the array.
    $_SESSION['idproduct'] = implode(',', $items);
    

提交回复
热议问题