Session_Start()不起作用 [英] Session_Start() Doesn't Work

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

问题描述




我是PHP的新手,我正在尝试创建一个登录表单。一旦用户登录

,他就不必再次登录了。问题是我得到每个页面之间的新会话ID,所以它不会识别用户。

我用过Session_Start()我以为是为了维持会话

页面之间的变量,但它不起作用。


任何想法或常见问题解答'?br />

谢谢

Chris

解决方案

" Chris Allen" c为C ***** @ nospam.co.uk>。在留言中写道

新闻:c6 ********** @ hercules.btinternet.com ...



我是PHP的新手,我正在尝试创建一个登录表单。一旦用户登录,他就不必再次登录了。问题是我在每个页面之间获得一个新的会话ID,因此它不会识别用户。
我使用了Session_Start(),我认为这是为了维护
页面之间的会话变量,但它不起作用。

任何想法或常见问题解答'

谢谢
Chris



您是否在每个页面上使用session_start?您确定您的系统是否已正确配置以存储会话?
您是否在会话中注册了

变量,因此可以在下一步中找到它们。页面?


- 维吉尔


>你在每个页面上使用session_start吗?您确定您的系统

是否已正确配置以存储会话?


我不知道如何检查?

您是否在会话中注册了
变量,因此可以在下一步中找到它们。页?


我在每页上都有session_start(),如果这就是你的意思。

" Virgil Green" < vj*@obsydian.com>在消息中写道

news:9N ***************** @ newssvr24.news.prodigy.co m ..." Chris Allen" c为C ***** @ nospam.co.uk>。在消息中写道
新闻:c6 ********** @ hercules.btinternet.com ...



我是PHP的新手,我正在尝试创建一个登录表单。一旦用户登录,他就不必再次登录了。问题是我


在每个页面之间获得

一个新的会话ID,所以它不会识别
用户。我已经使用了Session_Start(),我认为这是为了维护页面之间的


会话

变量,但它不起作用。

任何想法或常见问题解答'

谢谢
Chris



您是否在每个页面上使用session_start?您确定您的系统是否已正确配置以存储会话?您是否在会话中注册了
变量,因此可以在下一步中找到它们。页面?

- Virgil



完全无视任何安全措施Chris Allen

< c。***** @ nospam.co.uk>跳出来说:

你在每个页面上使用session_start吗?你确定你的
系统是否正确配置来存储会话?



我不知道如何检查?

你是在会话中注册你的
变量,以便在下一页页面上找到它们吗?



我在每个页面上都有session_start()这就是你的意思。




不,你需要明确定义你想要存储在会议中的变量。
会话。 />

例如:


<?php


session_start();


Hi

I''m new to PHP and I''m trying to create a Login Form. Once the user has
logged in then he shouldn''t have to log in again. The trouble is I''m getting
a new session ID between every page and so it doesn''t recognise the user.
I''ve used Session_Start() which I thought was meant to maintain the session
variables between pages but it doesn''t do work.

Any ideas or FAQ''s?

Thanks
Chris

解决方案

"Chris Allen" <c.*****@nospam.co.uk> wrote in message
news:c6**********@hercules.btinternet.com...

Hi

I''m new to PHP and I''m trying to create a Login Form. Once the user has
logged in then he shouldn''t have to log in again. The trouble is I''m getting a new session ID between every page and so it doesn''t recognise the user.
I''ve used Session_Start() which I thought was meant to maintain the session variables between pages but it doesn''t do work.

Any ideas or FAQ''s?

Thanks
Chris



Are you using session_start on every page? Are you certain your system is
properly configured to store the sessions? Are you registering your
variables with the session so they are available on the "next" page?

- Virgil


> Are you using session_start on every page? Are you certain your system is

properly configured to store the sessions?
I dunno how do I check?
Are you registering your
variables with the session so they are available on the "next" page?
I''ve got session_start() on each page if that''s what you mean.
"Virgil Green" <vj*@obsydian.com> wrote in message
news:9N*****************@newssvr24.news.prodigy.co m... "Chris Allen" <c.*****@nospam.co.uk> wrote in message
news:c6**********@hercules.btinternet.com...

Hi

I''m new to PHP and I''m trying to create a Login Form. Once the user has
logged in then he shouldn''t have to log in again. The trouble is I''m


getting

a new session ID between every page and so it doesn''t recognise the user. I''ve used Session_Start() which I thought was meant to maintain the


session

variables between pages but it doesn''t do work.

Any ideas or FAQ''s?

Thanks
Chris



Are you using session_start on every page? Are you certain your system is
properly configured to store the sessions? Are you registering your
variables with the session so they are available on the "next" page?

- Virgil



With total disregard for any kind of safety measures "Chris Allen"
<c.*****@nospam.co.uk> leapt forth and uttered:

Are you using session_start on every page? Are you certain your
system is properly configured to store the sessions?



I dunno how do I check?

Are you registering your
variables with the session so they are available on the "next"
page?



I''ve got session_start() on each page if that''s what you mean.



No, you need to explicity define the variables you want stored in
the session.

For example:

<?php

session_start();


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

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