MODx :: 获取 MODx 设置的会话 ID 以在模块中使用
我遇到一个问题,需要将会话 ID 传递给模块“SMF 连接器”。
该问题源于以下事实:由于某种原因,SMF 论坛(保存在子文件夹中)正在使用不同的会话集。我通过对 MODx 中的会话 ID 进行硬编码来解决这个问题,但当然,第二天我下次加载该网站时,这个方法就失败了。
我尝试过使用
global $modx;
$SID = $modx->documentObject[SID];
session_id($SID);
session_start();
但无济于事,事实上它阻止了整个论坛的加载!
有什么想法吗?
I have an issue where I need to pass the Session ID to a module, "SMF Connector".
The problem stems from the fact that for some reason the SMF Forum (held in a sub-folder) is using a different Session set. I combatted the problem by hard coding the Session ID from MODx, but of course this then failed the next time I loaded up the site a day later.
I have tried using
global $modx;
$SID = $modx->documentObject[SID];
session_id($SID);
session_start();
But to no avail, infact it was stopping the entire forum from loading!
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原因是 modx 会话数据仅限于 index.php 和其中包含的脚本。我想这是设计使然。
据我所知,您的 SMF 脚本是由单独的请求调用的。尝试在外部 php 脚本的开头添加以下行:
The reason is that modx session data is limited to index.php and scripts included from there. I suppose this is by design.
From what I gather, your SMF script is invoked by a seperate request. Try adding the following lines at the start of your external php script: