An example of a shopping cart implemented by PHP copy-write CodeIgniter

Source: Internet
Author: User
Tags codeigniter
This is about the shopping cart class where PHP implements the codeigniter of imitation writing. Share to everyone for your reference. Specific as follows:

Shopping Cart Basic Features:

1) Add items to your shopping cart
2) remove items from your shopping cart
3) Update Shopping cart item Information "+1/-1"
4) Statistics on shopping cart items
1. Total Items
2. Total Quantity
3. Total Amount
5) Statistics on the quantity and amount of items in the shopping item
6) Empty Cart

First download the PHP codeigniter that we need to use for this lesson: http://www.php.cn/xiazai/leiku/337

After the download, find the PHP class files we need, unzip to our local directory, create a new PHP file!

Once this is done, we will invoke this class in the new PHP file, and instantiate the class:

<?phprequire_once (' cart1.php ');//Introduction of class file  $cart = new cart ();//instantiation  $cart->insert ($items);  Var_dump ($cart->contents ());  $cart->update ($arr);  Var_dump ($cart->contents ());? >

The results of the operation are as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.