doucong6884 2018-08-15 10:47
浏览 12

Codeigniter库多个实例,无法正常工作

Iam developing a codeigniter POS system project.

I have separate sections to product sale and product GRN. both are using codeigniter cart library

in product sale section I created instance called : ocart

$this->load->library('cart','','ocart');
$ocart = $this->ocart->contents();
$this->ocart->destroy();
$this->ocart->insert($data);

product GRN section I created separate instance called : pcart

$this->load->library('cart','','pcart');
$pcart = $this->pcart->contents();
$this->pcart->destroy();
$this->pcart->insert($data);

When Im going to add product to the cart in sale section, same time same product added to the product GRN cart also. and wise versa.

then I checked array contents using print_r($pcart) and print_r($ocart);

both giving same output

Array
(
    [6b913a2317d00f7bfa0abdaff1a1f67f] => Array
        (
            [rowid] => 6b913a2317d00f7bfa0abdaff1a1f67f
            [id] => 22020
            [pcode] => DS141
            [note] => PLATE
            [qty] => 20
            [price] => 1
            [name] => 97280
            [subtotal] => 20
        )

)

what is wrong with above code, please advice.

  • 写回答

1条回答 默认 最新

  • dongyanzhui0524 2018-08-16 05:29
    关注

    There is no built-in method to destroy loaded library object. You can do simply like that by using unset or setting null.

    unset($this->my_library);
    

    OR

    $this->my_library = null;
    
    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?