我到底将SESSION_START放在哪里? [英] Where exactly do I put a SESSION_START?
问题描述
因此,我正在启动自己的网站,并且已经完成了登录文件.我只需要弄清楚将session_start放置在哪里以使用户保持登录状态.我到底将session_start放置在什么地方?我是否将其正确放置在登录文件中?还是我放在哪里?
So I'm starting my own website and I have the login file pretty much made. I just need to figure out where to put the session_start to keep the user logged in. Where exactly do I put the session_start? Do I put it right in the login file? Or where do I put it?
感谢您的帮助
推荐答案
将其放在您的PHP开始标记之后 <?php
... ...
Put it after your PHP start tag <?php
... like this
<?php
session_start();
//... your code....
//more code....
从PHP手册中阅读有关会话的更多信息. Here
Read more on sessions from the PHP Manual. Here
注意:另外请记住,如果要使用会话变量,则需要在每个页面上调用session_start();
.
Note : Also keep in mind, you need to call session_start();
on each and every page if you are making use of session variables.
这篇关于我到底将SESSION_START放在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!