在 PHP 会话变量中存储 XML 对象 [英] Storing XML object in PHP Session Variables

查看:30
本文介绍了在 PHP 会话变量中存储 XML 对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于这个话题有很多讨论,但我还是想问这个问题以确定适合我的具体情况的最佳方法......

There are a lot of discussions on this topic but I'd like to ask this question anyways to determine the best approach for my specific situation...

我在 CakePHP 中使用了linkedIn API.从 LinkedIn API 我得到一个 XML 对象.我想将这个 XML 对象(整个事物)存储在一个会话变量中,这样我就不必在每个页面上调用 API.我的理解是不可能在 PHP 会话中存储 XML 对象.通常的解决方法是什么?

I'm using the linkedIn API with CakePHP. From the LinkedIn API I get an XML object. I would like to store this XML objects (the whole thing) in a session variable so I do not have to call the API on every page. My understanding is that it's not possible to store XML objects in a PHP Session. What is the usual workaround for this?

我已经编写了很多读取/操作 XML 对象的代码,所以我想避免将对象转换为数组或其他东西,这样我就不需要重写此代码.

I've already written a lot of code that reads/manipulates the XML objects, so I'd like to avoid turning the object into an array or something else so that I do not need to rewrite this code.

非常感谢

推荐答案

为什么不将 XML 对象存储为 XML 字符串?激进,我知道.

Why don't you store the XML object as an XML string? Radical, I know.

这篇关于在 PHP 会话变量中存储 XML 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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