This article mainly introduces PHP Session control: Session and Cookie Details. This article describes Session and Cookie related knowledge in PHP in detail and covers a wide range of topics, for more information about PHP session control, see the
This article introduced the PHP session control, mainly elaborated the following several things:
• Background/concept of Session controlMaintenance and life cycle of • Cookies (effective time)Maintenance and life cycle of session (recovery
How to modify the session lifetimeLet's set the lifetime of the Session manually:Session_Start ();Save the day$lifeTime = 24 * 3600;Setcookie (Session_name (), session_id (), time () + $lifeTime, "/");? >In fact, the Session also provides a function
How to modify the session lifetimeLet's set the lifetime of the Session manually:Session_Start ();Save the day$lifeTime = 24 * 3600;Setcookie (Session_name (), session_id (), time () + $lifeTime, "/");? >In fact, the Session also provides a function
This article mainly shares the knowledge about the life cycle of the PHP session.
First of all, the beginning of the session creation to the end of the process.
When a program needs to create a session for a client's request, the server first
1. How PHP session worksThe Session file is stored on the server. By default, the Directory of the SESSION file is specified by session. save_path. The file name is prefixed with sess _ and followed by session id, for example, sess_c000065af28a8b14c0
The Session is stored on the server as a text file, so the client is not afraid to modify the Session content. In fact, in the Session file on the server side, PHP automatically modifies the Session file permissions, only retaining the system read
Compared with cookies, Session is stored on the server, which is relatively secure and has no storage length limit as Cookie does. This article briefly introduces the use of Session. The Session is stored on the server as a text file, so the client
Compared with cookies in PHP Development, session is stored on the server side, which is relatively secure and has different storage length limits than Cookie, this article briefly introduces the use of session compared to cookies in PHP Development.
1. How PHP Session Works
Session file is stored on the server side, by default, the directory saved by the session file is specified by Session.save_path, the file name is prefixed with Sess_, followed by the session ID, such as: Sess_ c72665af28a8b1
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.