且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 rails 和 wordpress 之间共享会话数据

更新时间:2023-08-17 19:02:40

这两个应用程序是否在同一台主机上运行?同一个域?共享数据库?

Are the 2 applications running on the same host? Same domain? Sharing database?

听起来您***的选择是某种身份验证服务,例如众多 OAuth 身份验证服务之一(Facebook、Twitter 等),或者编写您自己的 OAuth 服务.

Sounds like your best option is some sort of authentication service, like one of the many OAuth authenticator services (Facebook, Twitter, etc.), or writing your own OAuth service.

或者,如果这两个应用程序是小规模的并且在同一台机器上运行,则可以修改 rails 应用程序或 WordPress 的会话处理程序以使用另一个的会话数据.我怀疑 WordPress 会是两者中更容易修改的,但我偏向于 PHP

Alternatively, if the 2 applications are small-scale and running on the same machine, it might be possible to modify the session handler for either the rails app or WordPress to use the other's session data. I suspect WordPress would be the easier of the two to modify, but I have bias toward PHP

快速搜索并找到了这篇关于修改 Rails cookie 会话以与 PHP 一起使用的文章.

Did a quick search and found this article about modifying Rails cookie sessions to use with PHP.

https://www.coffeepowered.net/2011/08/24/rails-cookie-sessions-and-php/

我还发现了这篇文章,这可能正是您要查找的内容?http://code.tutsplus.com/tutorials/build-a-custom-api-to-connect-wordpress-with-ruby-on-rails--cms-21189

I also found this article which might be exactly what you're looking for? http://code.tutsplus.com/tutorials/build-a-custom-api-to-connect-wordpress-with-ruby-on-rails--cms-21189

不幸的是,我从未从任何一个方向尝试过.但我对 WordPress 非常熟悉,并且相信只要有足够的血汗和泪水,它可以与 Rails 会议一起使用.

Unfortunately, I have never attempted this from either direction. But I am very familiar with WordPress, and believe it could be made to corporate with Rails sessions, given enough blood, sweat and tears.