在PHP中传递页面之间的数据 [英] Passing data from page to page in PHP

查看:72
本文介绍了在PHP中传递页面之间的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我有一个新的项目,我以前没有做过这样的事情,但迄今为止这么好。我需要将一些数据从一个页面传递到另一个页面,并且传递的数据量没有限制。



起初,我是考虑发布它,然后当每个页面加载时,只需抓住POST数据,并将其存储在一个数组中,但对于我来说,这听起来有点过于复杂或我想做的事情。



然后我想到了HTML5和localStorage,但是由于localStorage存在限制,并且大多数用户浏览器仍然不支持它(即大多数我的客户客户浏览器),这是一个很大的不是,在这一点上。



所以,现在我全都没有想法。 b

这是我正在做的事情,这听起来很简单,但我不知道如何去做。



在任何给定的页面上,可能有超过一百个链接,每个链接代表产品名称或产品信息,如果他们点击这些链接油墨,然后移动到另一个页面,然后关于他们点击什么产品名称的信息会跟随他们到新的页面,然后同样的事情发生在新页面上,如果他们再次点击其中一个链接,然后新的信息将被添加到现有的信息,并传递到他们访问的任何新页面。

我想你可以说它几乎完全像购物车一样工作,如果用户添加到购物车,他们的购物车以及其中的所有数据,他们都可以直接进行结账。



我会很感激所有帮助吗?

解决方案

我想你真的想为此使用数据库。用户点击时,每个页面都会将数据从数据库中提取出来。我保证,对于来自数据库的大约一百个对象,从每个新页面访问数据库的时间比来自用户浏览器的往返HTTP时间要小一个数量级。

Well, I have a new project, and I've not done anything like it before, but so far so good. I am in need of having to pass some data from one page to another, and there is no limit to the amount of data that gets passed.

At first, I was thinking of POST-ing it, and then when each page loads, just grab the POST data, and store it in an array, but to me that sounds a bit too over complicated or something for what I want to do.

Then I thought about HTML5 and localStorage, but since there is a limit on localStorage, and the fact that the majority of users browsers still don't support it yet (that is, the majority of my clients customers browsers), that's a big no no, at this point.

So, now I'm all out of ideas.

Here's what I'm trying to do, it sounds pretty simple to me, yet I can't figure out how to go about it:

On any given page, there are a probably over a hundred links, each link represents either a name of a product or information about a product, if they click on of these links, and then move off to another page, then the information about what product name they clicked on would follow them to that new page, and then the same thing happens on the new page, if they click on one of those links again, then new info will be added to existing information, and passed on to whatever new page they visit.

I guess you could say that it works almost exactly like a shopping cart, whereby if a user Adds to Cart, their Cart, and all data inside it follows them right to Checkout.

I'd appreciate any help at all?

解决方案

I think you really want to use a database for this purpose. Each page pulls the data out of the database as the user clicks through. I guarantee you that for a hundred or so objects from the database, the time to access the database from each new page is an order of magnitude smaller than the round trip HTTP time from the user's browser.

这篇关于在PHP中传递页面之间的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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