Example #1
0
 function editGoods()
 {
     $goods = array('id' => E_POST('id'), 'name' => E_POST('name'), 'intro' => E_POST('intro'), 'price' => E_POST('price'), 'pic' => E_POST('pic'));
     $model = new GoodsModel();
     $model->editGoods($goods);
     $this->out_json(true, "edit success");
 }
Example #2
0
 function add2cart()
 {
     $goodsId = E_POST('goodsId');
     $cart = array();
     $goods = array();
     $count = 1;
     session_start();
     if (array_key_exists('cart', $_SESSION)) {
         $cart = $_SESSION['cart'];
     }
     if (array_key_exists($goodsId, $cart)) {
         $count = $cart[$goodsId]['count'] + 1;
     }
     $goods = array('count' => $count);
     $cart[$goodsId] = $goods;
     $_SESSION['cart'] = $cart;
     print_r($_SESSION['cart']);
     //echo $goodsId;
 }