欢迎使用--=金星session实例购物车=-- 欢迎共同学习讨论,我的QQ:183660546 email:51chinese@163.com
介绍:
使用session 开发,session使用方便,速度快。这原来是一个国外的朋友开发的类,我只是在这基础上增加了应用部分,也可以在此基础上做更多的扩展,欢迎朋友们使用。
shop.php ---- 商品页面,购物从这里开始。
lizi.php ---- 购物车页面,显示购物车。
basketlib.php ---- 这是类文件,需要嵌入到使用页面中。
gai.php ---- 修改购物车数量、删除等转向页。
jie.php ---- 结算购物车中的商品。
dingdan.php ---- 生成订单,文件中用的是数据库,将订单写入数据库表中。
sql.txt ---- 附带数据库表。
使用方法:
shop.php 开始页面填入相应数据,进行购物。
session类中的一些方法使用:
注册一个session类
---------------------------------------
session_start();
if (! ssession_is_registered("basket") ) {
$basket=new Basket;
session_register("basket");
}
---------------------------------------
添加一件商品
-----------------------------------------------------------------
$basket->Add_Item($ITEM_ID,$DISPLAY_NAME,$quantity,$price,$data);
------------------------------------------------------------------
Del_* Get_* Set_* 删除商品 \ 得到商品值 \ 设置数量 (这只是几个例子,更多方法可以看类文件)
-------------------------------------------------------------------
$basket->Del_Item(0)
$basket->Get_Item_Data(0)
$basket->Set_Item_Quantity(0,0)
-------------------------------------------------------------------
得到购物车所有的商品
-----------------------------------------------------------------------------
if ($basket->Get_Basket_Count()>0) {
$pos = $basket->Enum_Items(true);
while ($pos>=0) {
print $basket->Get_Item_Name($pos)."-".$basket->Get_Item_Quantity($pos)."<BR>";
$pos = $basket->Enum_Items();
}
}
--------------------------------------------------------------------------------------------------
清空购物车
-----------------------------
$basket-> Empty_Basket();
-----------------------------
可以在每个页面中按照您自己的习惯设置,挺好用的.
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃源码网 - 下载文件说明: CodePub.Com┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ 如有转载请勿删除本说明文件,谢谢合作 ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃【使用前请您先阅读以下条款,否则请勿使用本站提供的文件!】 ┃
┃ 1) 推荐使用:WinRAR V3.4以上版本解压本站软件 ┃
┃ 2) 本站不保证所提供软件或程序的完整性和安全性。 ┃
┃ 3) 请在使用前查毒 (这也是您使用其它网络资源所必须注意的) 。 ┃
┃ 4) 由本站提供的程序对您的网站或计算机造成严重后果的本站概不负责。┃
┃ 5) 本站提供的程序均为网上搜集,如果该程序涉及或侵害到您的版权请立┃
┃ 即写信通知我们。 ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ 如果遇到MD5加密文件(一般都是这个),而又不知道密码的, ┃
┃ 请用这组加密的数据1739fddf100746ca替换,那么密码就是:codepub.com ┃
┃ (这个是16位的,32位的是:7773164f11739fddf100746ca6b337834) ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ 欢迎广大程序作者到本站发布您的作品! ┃
┃ 源码网 - 源码发布与下载 ┃
┃ 联系邮箱:wuse#codepub.com( #替换成@ ) ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![m](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![py](https://img-home.csdnimg.cn/images/20210720083646.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 8 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/6ba19994c6c3461f8cf75ff80f635020_qq_34910341.jpg!1)
CyMylive.
- 粉丝: 7501
- 资源: 4万+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)