Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP会话变量等效于平均堆栈_Php_Session_Mean Stack - Fatal编程技术网

PHP会话变量等效于平均堆栈

PHP会话变量等效于平均堆栈,php,session,mean-stack,Php,Session,Mean Stack,当我第一次开始学习PHP时,您可以使用$\u会话数组存储信息并在多个站点上使用它,比如设置登录用户的用户名 平均堆栈是否有类似的功能?模块使用express session 初始化 app.use(session({secret: 'something'})); 下面代码中的sessionVariable相当于php中的$\会话 var sessionVariable; app.get('/',function(req,res){ sessionVariable=req.s

当我第一次开始学习PHP时,您可以使用$\u会话数组存储信息并在多个站点上使用它,比如设置登录用户的用户名

平均堆栈是否有类似的功能?

模块使用express session

初始化

app.use(session({secret: 'something'}));
下面代码中的sessionVariable相当于php中的$\会话

  var sessionVariable;
    app.get('/',function(req,res){
    sessionVariable=req.session;

    sessionVariable.email = 'test@test.com;
    sessionVariable.username = 'test'; 
    });

如果我在一个文件中有这个代码,而一个人在另一个文件中访问这个变量,那么我必须在这些文件中包含什么?你能详细说明一下吗?
  var sessionVariable;
    app.get('/',function(req,res){
    sessionVariable=req.session;

    sessionVariable.email = 'test@test.com;
    sessionVariable.username = 'test'; 
    });