哪种方法更适合制作购物车应用程序 [英] which approach is better for making shopping cart application

查看:68
本文介绍了哪种方法更适合制作购物车应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想申请购物车.我使用贝宝(Paypal)API付款.我很困惑我必须使用哪种方法来制作运输车.我研究了购物车制作可以通过三种方式完成:使用会话,使用基于cookie的方法和使用数据库方法..贝宝可以支持这三种方法.哪个更可靠.我的问题听起来可能很愚蠢..但是很抱歉,我想要一些信息.

i want to make a shopping cart application. lator i use the paypal api for payments. i am confused which approach i have to use for making shipping cart. i studied that shopping cart making can be done in three ways.. using sessions, using cookie based apprach and using database approach.. can paypal support the three apporaches. which one is more relable. my question maybe sound stupid.. but sorry i want some info.

推荐答案

Paypal API不在乎如何在您的Web应用程序中存储用户数据,因此所有三个选项可供您选择.

基于Cookie的:
您的数据存储在会话之间,即当用户再次访问站点时(在以同一用户身份登录的同一台PC上),当用户在购物卡中放入某些东西并关闭其浏览器时,该数据仍在购物卡中.
但是出于某种原因,我避免使用cookie,因为您的用户可能已经关闭了cookie.

基于会话:
它易于使用,但是一旦用户关闭浏览器,它就消失了.

基于数据库:
像Cookie一样,您的数据存储在会话之间,但是对于我来说,购买购物卡似乎很麻烦.

会话+数据库:
如果您具有登录系统,则可以在用户登录后从数据库中将购物卡数据检索到会话中,并且在会话结束后,将购物卡数据从会话中持久保存到数据库中.
the Paypal API doesn''t care how store user data in your web application, so all three options are available to you.

Cookie based:
Your data is stored between sessions, that is when a user puts something in his shopping card and closes his browser it''s still in his shopping card when you visits your site again (On the same PC logged in as the same user).
But I avoid using cookies for one reason, your user might have turned off cookies.

Session based:
It''s easy to use, but once the user closes his browser it''s gone.

Database based:
Like cookies, your data is stored between sessions, but it seems like to much hassle to me for a shopping card.

Session+Database:
If you have a login system, then you could, once a user logs in, retrieve the shopping card data from the database into session and once the session ends persist the shopping card data from the session to the database.


这篇关于哪种方法更适合制作购物车应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆