Python Cookie 和 PHP virtual()

发布于 2024-10-01 18:27:04 字数 278 浏览 0 评论 0原文

我缩小了问题范围:

os.environ.get('HTTP_COOKIE')

当使用 PHP 的 virtual() 调用带有该行的 Python 文件时,这似乎总是 None 。有谁知道这是为什么?

我使用 Python 2.7 是因为我非常需要 Python 成像库。

编辑:没关系,它已经修复了。这是因为我是个白痴,不知道我必须将cookie的路径设置为/,导致它只能在生成cookie的地方工作。

I narrowed down the problem:

os.environ.get('HTTP_COOKIE')

This always seems to be None when calling the Python file with that line using PHP's virtual(). Does anyone know why this is?

I'm using Python 2.7 because of how much I need the Python Imaging Library.

EDIT: Never mind, it's been fixed. It was because I'm an idiot and didn't know I had to set the cookie's path to /, causing it only to work where the cookie was generated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘦怹 2024-10-08 18:27:04

尝试使用 apache_setenv 函数自行设置 cookie。
但是,如果您从 python 中需要的唯一东西是 PIL,那么您可能根本不需要 python。 PHP 有非常强大的工具,例如 MagickWand,这是一个图像 magick 的前端。

Try to set cookies by your own with apache_setenv function.
But if the only thing that you need from python is PIL, then you probably don't need python at all. PHP have very powerful tools like MagickWand, a frontend to image magick.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文