In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces what session_start() means in php, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.
In php, session_start() means "start session" and is a built-in function for creating new sessions or reusing existing ones; the syntax is "session_start($array);" which returns true if the session is successfully started and false otherwise.
Operating environment of this tutorial: Windows 7 system, PHP7.1 version, DELL G3 computer
In PHP, session_start() means "start session."
Grammar:
session_start(array $options = array()): bool
The session_start() function creates a new session or reuses an existing session. If the session ID is submitted via GET or POST, or using cookies, existing sessions are reused.
Parameters:
$options: This parameter is an associative array that, if provided, overrides the configuration items in the session configuration indication with the items in it. The keys in this array do not need to contain sessions. prefix.
In addition to the regular session configuration indicators, you can also include the read_and_close option in this array. If this option is set to true, the session file is closed as soon as the read is complete, thus avoiding unnecessary file locks when the session data has not changed.
When a session starts automatically or manually via session_start(), PHP internally calls the session manager's open and read callbacks. The session manager may be PHP's default, provided by an extension (SQLite or Memcached extension), or user-defined via session_set_save_handler(). Existing session data returned by the read callback function (stored in a special serialization format), PHP automatically deserializes the data and populates the $_SESSION superglobal variable.
To use named sessions, call the session_name() function before calling the session_start() function.
If the session.use_trans_sid option is enabled, the session_start() function registers an internal output manager that does the work of URL rewriting.
If the ob_start() and ob_gzhandler functions are used together, the order in which the functions are called affects the output. For example, the ob_gzhandler function must be called to complete registration before starting a session.
Return value: true if the session is successfully started, false otherwise.
Example 1:
After requesting the page1.php page, the second page page2.php contains session data. For more information on session ID transfer, see the Session Reference page, which has detailed instructions on the constant SID.
Example 2: Overriding Cookie timeout settings
Thank you for reading this article carefully. I hope that Xiaobian will share the meaning of "session_start() in php". This article is helpful to everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.