写会话从一页还是全部页面开始? [英] Write session start on 1 page or all pages?
问题描述
所有教程都说开始会话.他们没有说是应该出现在网站的所有页面中,还是应该出现在某些页面中,或者只显示1个页面.
All the tutorials say to put session start. They don't say if that should be in all pages on the website, or some, or only 1.
如果只有一页,它必须是主页吗?还是具有我正在制作的将页面的会话ID放入数据库的表单的页面?如果访问者从不访问具有会话ID的页面,但是他们在网站上,那么他们仍然具有会话ID吗?
And if it's only 1 page, does it have to be the main page? Or a page with a form that I am making that puts the session ID in the database? If the visitor never visits a page with a session id but they are on the site, do they still have a session id?
推荐答案
您需要在访问(或创建)任何会话数据之前将其放在需要访问会话数据的每个页面中.
You need to put this in each page that need to access the session data before accessing (or creating) any session data.
请参阅: http://php.net/manual/en/function. session-start.php
这篇关于写会话从一页还是全部页面开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!