有没有什么办法获取会话数据在Codeigniter的应用程序文件夹之外的文件夹?

编程入门 行业动态 更新时间:2024-10-27 09:33:16
本文介绍了有没有什么办法获取会话数据在Codeigniter的应用程序文件夹之外的文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个文件夹 / application 的文件夹CodeIgniter名为 myfolder 。

I have a folder outside /application folder of CodeIgniter called myfolder.

我的CI应用程序使用本机PHP会话,一切正常。 CI版本是最新的3.0版本。

My CI application uses Native PHP sessions and it all works fine. CI version is the latest 3.0-development.

我需要访问myfolder / myfile.php中的一些会话数据。如果我做一个 session_start()然后 print_r($ _ SESSION); 由CI的会话驱动程序。我明白为什么它不显示它。

I need to access some of the session data in myfolder/myfile.php. If I do a session_start() and then print_r($_SESSION); then I don't see the session set by CI's session driver. I understand why it doesn't show it.

你知道任何方法/黑客,我可以参考在myfolder中的CI会话的会话数据。例如通过直接包括,例如,Codeigniter / libraries / session / drivers / session_native.php或任何其他文件?我只是会话数据的数组。

Do you know any method/hack by which I can refer to session data from the CI's session in myfolder. for example by directly including, say, Codeigniter/libraries/session/drivers/session_native.php or any other file?? I just an array from the session data.

推荐答案

当前 Session_native.php 似乎没有更改任何内置的会话库的偏好或干扰如何保存会话数据,我认为以下应该工作:

The current Session_native.php doesn't seem to change any of the built in session library's preference or interfere with how the session data is saved, i think the following should work:

  • 获取要加载的会话的会话ID
  • 在之前调用 session_id($ sessid)
  • 呼叫 session_start()
  • Get a hold of the session id for the session you want to load
  • call session_id($sessid) with this session id before session_start()
  • call session_start()

这应该工作,只要控制会话lib的各种ini设置像 session.save_path 是相同的,也许(如果您的主机安装了此扩展) suhoshin设置,例如 suhosin.session.cryptdocroot 不会干扰。

This should work as long as the various ini settings that control the session lib like session.save_path is the same and maybe (if your host have this extension installed) suhoshin settings like suhosin.session.cryptdocroot doesn't interfere.

更多推荐

有没有什么办法获取会话数据在Codeigniter的应用程序文件夹之外的文件夹?

本文发布于:2023-11-12 17:03:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582043.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   有没有什么   应用程序   办法   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!