从python(wsgi)访问php $ _SESSION-有可能吗? [英] Accessing php $_SESSION from python (wsgi) - is it possible?

查看:99
本文介绍了从python(wsgi)访问php $ _SESSION-有可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个python/WSGI应用程序,需要检查用户是否已登录到PHP Web应用程序.问题在于,PHP应用程序通过将$ _SESSION变量中的值与用户浏览器中cookie中的值进行比较来检查用户是否已登录.如果可能的话,我宁愿避免更改php应用程序的行为.

I've got a python/WSGI app which needs to check to see if a user has logged on to a PHP web app. The problem is that the PHP app checks if a user has logged on by comparing a value in the $_SESSION variable to a value in the cookie from the user's browser. I would prefer to avoid changing the behavior of the php app if at all possible.

我的问题:

  1. 我是否仍然可以从python中访问会话变量?我应该从哪里开始看?

  1. Is there anyway I can access the session variables from within python? Where should I start to look?

采用这种方法时,我应该注意任何明显的安全/性能问题吗?

Are there any obvious security/performance issues I should be aware of when taking this approach?

推荐答案

  1. 是的.会话(默认情况下)是常规文件.因此,您所需要做的就是查看会话目录并找到带有会话Cookie值名称的文件.然后-您必须实现类似php的序列化/反序列化并做您想做的任何事情.

  1. yep. session (in default) is a regular file. so all what you need is look over session directory and find file with name of session cookie value. then - you have to implement php-like serialize/unserialize and do whatever you want.

没有

这篇关于从python(wsgi)访问php $ _SESSION-有可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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