在 node.js 中读取 PHP Session 数据 [英] Read PHP Session data in node.js

查看:55
本文介绍了在 node.js 中读取 PHP Session 数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 php 和 node.js 开发一个项目.我在会话中有一些数据,例如

I am working on a project in php and node.js. I have some data in session like

[user]= ARRAY([0]=> stdClass Object([username] => XXX, [app_id] -> XXX))

现在我想从会话中读取 app_id 并需要在 node.js 中使用

Now i want to read app_id from session and need to use in node.js like

var myquery =
            "SELECT count(cs.id ) AS new_message " + 
            "FROM dcms_corr_status as cs " +
            "LEFT JOIN `dcms_user` as u ON `u`.`appointment_ref_no` = `cs`.`appointment_ref_no` "+
            "WHERE `cs`.`appointment_ref_no` = '" + user_app +"' AND `cs`.`isread` = 0 " +
            "AND `cs`.`action_or_info` = 1";
var query = connection.query(myquery),

其中 user_app 是我的会话数据.

where user_app is my session data.

我该怎么做?

推荐答案

如果你真的想在 node 中解析 PHP 会话文件,你可以尝试 呻吟.否则你可能会考虑使用 MySQL, memcachedRedis 代替您的会话存储.

If you really want to parse a PHP session file in node you could try groan. Otherwise you might look into using MySQL, memcached, or Redis for your session storage instead.

这篇关于在 node.js 中读取 PHP Session 数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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