I have a PHP page that has session_start() at the very top. Halfway through the page, if a certain condition is met, the page is reloaded using JavaScript. I'm wondering if session_start() is called again when the page is reloaded or does PHP know to skip it since the session has already started?
session_start — Start new or resume existing session. Starts a new session if not started else resumes the existing session.
Added You could check and initiate, like:
if (session_id() == "") {
session_start();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.