duanbiao4025 2019-04-29 17:54
浏览 74

使用mongoDb与express(nodejs)和php共享会话

So i have an application in php and nodejs. We have the user login etc. and we need sessions to identify the users.

So here is the challange, i have setup a session_set_save_handler in php but it seems like php adds something to my session id.

For example: Nodejs makes a session this is the unique string (the session id) 3763fb0e67340d47b1e4ead3eabb38011a10c5ef868527ea265def87d2db80a16fbc42e76ba50df2c09cc2fa7f3cbafa89dd99b85c4ae2190c91bf7069e4dbde

If i go to php to get this session it makes it like: s:3763fb0e67340d47b1e4ead3eabb38011a10c5ef868527ea265def87d2db80a16fbc42e76ba50df2c09cc2fa7f3cbafa89dd99b85c4ae2190c91bf7069e4dbde.tckNyYsYCYOBbPcdUBAsI7D77UE6Ma/9Y5VTMAn5umg

I see the unique id is in the string passed trough the session_set_save_handler But it seems like it is serialized but i can't figure out in what way. And what i can do to get out the original id generated by NodeJs.

Sure i can explode on the : and . to get the unique id set by nodejs but is this save? And why does php behaive like this?

How can i make the variable $sessionId passed throu the methodes set by session_set_save_handler.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
    • ¥20 matlab yalmip kkt 双层优化问题
    • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体