简体   繁体   English

如何在Symfony2和Wordpress之间共享会话

[英]How to share session between Symfony2 and Wordpress

I have a project built in Symfony2. 我有一个在Symfony2中构建的项目。 I'm using FOSUserBundle to manage users. 我正在使用FOSUserBundle来管理用户。 Now I have to integrate Wordpress into my project. 现在,我必须将Wordpress集成到我的项目中。 Wordpress has to be available in subfolder: http://example.com/blog . Wordpress必须在以下子文件夹中可用: http : //example.com/blog I already managed to achieve such state, everything works like a charm, but now I need to share session between Symfony2 project and Wordpress. 我已经设法达到这样的状态,一切都像个魅力,但是现在我需要在Symfony2项目和Wordpress之间共享会话。 Actually I don't really know if session share is right solution to my problem. 其实我真的不知道会话共享是否是解决我的问题的正确方法。 The thing is that I want to the same design in Wordpress as I use in Symfony project. 问题是我希望在Wordpress中使用与Symfony项目中相同的设计。 In my Symfony project I have a top bar which indicates that user is authenticated. 在我的Symfony项目中,有一个顶部栏,指示用户已通过身份验证。 If user will authenticate via Symfony (I want it to be the only possible way) I want him to see that he is authenticated also while browsing the Wordpress blog. 如果用户将通过Symfony进行身份验证(我希望它是唯一可行的方法),我希望他在浏览Wordpress博客时也能对他进行身份验证。 So session share was my first thought, but maybe there are other, more effective solutions? 因此,会议份额是我的第一个想法,但也许还有其他更有效的解决方案? Maybe loading this top bar into iframe in Wordpress? 也许将顶部栏加载到Wordpress中的iframe中? Can EkinoWordpressBundle solve my problem? EkinoWordpressBundle能解决我的问题吗?

If the WordPress installation is on the same domain in a folder, the session should be available trough PHP. 如果WordPress安装位于文件夹中的同一域中,则该会话应可通过PHP使用。 You can check it by using the $_SESSION variable from PHP and add some code to your header.php to show the authentication details . 您可以使用PHP中的$ _SESSION变量进行检查,并将一些代码添加到header.php中以显示身份验证详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM