Wordpress - 将php对象传递给新页面[关闭]

Wordpress  - 将php对象传递给新页面[关闭]

问题描述:

I am creating a custom ordering site built using Wordpress. I've created an object-oriented plugin to store all the order details. (product specs, contact information, various options, etc) The ordering process spans three pages. What is the best way for me to pass the object from one page to the next that is the most widely browser friendly? JSON encoding? Serialization? $_SESSION variable? Wordpress does not allow this natively, but I found instructions on how to override this.

Any suggestions would be greatly appreciated!

我正在创建一个使用Wordpress构建的自定义订购网站。 我创建了一个面向对象的插件来存储所有订单细节。 (产品规格,联系信息,各种选项等)订购流程跨越三页。 对于我来说,将对象从一个页面传递到最广泛的浏览器友好对象的最佳方式是什么? JSON编码? 序列化? $ _SESSION变量? Wordpress本身不允许这样做,但我找到了如何覆盖它的说明。 p>

任何建议都将不胜感激! p> div>

I would recommend storing data in different indexes of $_SESSION, so the information will remain persistent across pages.

Because you aren't implementing a feature like search, $_SESSION is good choice because users may switch between ordering products and visiting other pages on your site. Additionally, this method does not depend on browser features.