有没有什么办法获取会话数据在Codeigniter的应用程序文件夹之外的文件夹? [英] Is there any way to get session data in folder outside Application folder of Codeigniter?

查看:123
本文介绍了有没有什么办法获取会话数据在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的应用程序文件夹之外的文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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