duanjianl183188 2016-02-17 21:26
浏览 23

如何从选定的PHP会话文件中读取

Is there a solution that allows me to create a session file based on the first request(request is not coming from a browser but contains a unique ID that will be maintained for a given period/session) and then read from this session file on subsequent requests coming from this same user (identified by the unique ID in request)?

I thought that when I set a session_id($id) or session_name($name) on the first request and create a session(ie session file), I will be able to on user's subsequent request identify and read this session file and pick values from it.

Note: These requests are not coming from a browser.

In a web browser, the cookie holds the ID that identifies the session files so values can be picked from it on subsequent requests. But I don't have this available.

EDITED TO ADD CODE LOGIC

if($_GET['sequence'] == 0)  // first request
{
    $uniqueID = $_GET['uniqueID'];
    // I thought     this will create a session file with value provided
    session_id("ses$uniqueID");
    session_start();
    $_SESSION['data1'] = $_GET['data'];
}
else // subsequent request
{
    // we should have a session file, so I thought this will fetch it
    $uniqueID = $_GET['uniqueID'];
    session_id("ses$uniqueID");  //;(
    session_start();
    $data = $_SESSION['data1'];
}
// ....`
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?