两个子域之间的通信。 Zend框架
我正在向 Zend 驱动的站点添加一个公告板,并使用名为 Phorum 的开源公告板。虽然理论上可以将 Phorum 集成到我的 Zend 站点中,但它已经是独立的,并且不是设计为通过控制器运行的。
我的解决方案是为 Phorum 创建一个子域,效果非常好。然而,我的下一个愿望是将我的登录系统与 Phorums 集成,这样我的用户就不必登录两次。我的登录是通过ajax 进行的,并通过Zend_Auth 运行。
为了保持登录状态,我创建了一个名为 messageboard 的控制器,它将我的登录信息保留在页面上,然后通过 iframe 加载公告板。这使我能够将登录的 Zend 组件保留在与新公告板相同的页面上。
这是我的新问题。在集成登录系统时,我需要一种在 Phorum Iframe 和 Zend 站点之间来回传递消息的方法。无论是让 Phorum 检查我的 Zend 会话以查看它是否存在,还是只是将 ajax 消息从 Zend 传递到 Phorum 都无关紧要。是否可以做到这一点以及如何做到?我相信两个子域不共享相同的会话,但我只是不确定。
I'm adding a bulletin board to my Zend-driven site, and am using an open source one called Phorum. While it would be theoretically possible to integrate Phorum into my Zend site, it's already self contained, and not designed to run through a controller.
My solution was to make a sub-domain for Phorum, which worked quite well. However, my next desire is to integrate my login system with Phorums, so my users don't have to log in twice. My login occurs through ajax, and runs through Zend_Auth.
In order to keep my login up, I've created a controller named messageboard, which keeps my login on the page, and then loads the bulletin board through an iframe. This allows me to keep the Zend component of my login on the same page as my new bulletin board.
Here's my new problem. In integrating the login systems, I need a way of passing messages back and forth from the Phorum Iframe to the Zend site. Whether this is having Phorum check my Zend Session to see if it exists, or simply passing an ajax message from Zend to Phorum doesn't matter. Is it possible to do this, and how? I believe that two subdomains don't share the same sessions, but I'm just not sure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能拥有跨域的会话(确切地说是会话 cookie)。
您可以将 phorum 添加到公共文件夹中。这应该与默认的 ZF 重写规则一起使用,因为它只能重写不存在的文件。
You cant have a sessions (session cookie to be exact) crossing a domain.
you could add the phorum in the public folder. This should work with the default ZF rewriting rules, couse its only rewriting files which dont exist.