PHP:会话不起作用 [英] PHP: Session not working

查看:49
本文介绍了PHP:会话不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户在客户端登录时,我正在重定向到服务器,一旦他的 user_id 和密码得到验证,我就会在 user_id 上设置会话,我正在重定向回客户端.然后,我要求填写个人资料信息.如果他想通过 facebook 填写信息,则会出现弹出窗口,要求对 facebook api 进行许可.

when user log's in at client, i am redirecting to server, ther i am setting session on user_id once his user_id and password are verified, i am redirecting back to client. then, i am asking to fill profile info. if he want to fill the info by facebook, popup window appear which asks for permision to facebook api.

然后我想将访问令牌存储到数据库中.为此,我将使用 user_id、accesstoken 和其他信息重定向到服务器.我正在检查会话以验证他是同一用户.

then i want to store access token into db. for this i am redirecting to server with user_id , accesstoken and other info to server. there i am checking session to verify that he is same user.

但不工作.更多详情:

在服务器中,我有两个函数,validate() 和 facebook().在验证功能中,我正在创建会话.当我从验证功能转到 Facebook 功能时,如果我回显user_id"的会话,它正在打印.-------- 但是,当我向客户端站点验证功能,然后如果返回到服务器/facebook 时,它不会打印

In server, i have two function, validate() and facebook(). In validate function, i am creating session. when i am going from validate function to facebook function and thr if if i echo session of 'user_id' it is printing. -------- but, when i go validate function to client site and then if came back to server/facebook it is not printing

推荐答案

你使用函数 session_start() 吗?

这在大多数情况下都能解决问题.

That will fix the problem most of the times.

这篇关于PHP:会话不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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