Home  >  Article  >  Backend Development  >  Configuration related to session and cookie in php.ini_PHP tutorial

Configuration related to session and cookie in php.ini_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:47:431057browse

This article will introduce you to the detailed configuration of session and cookie in php.ini. I hope this tutorial will be helpful to all students.

1,session.use_cookie = 1

Whether to use the Cookie method to pass the session id value. The default is 1, which means enabled.

2,session.name = PHPSESSID

Whether the cookie passes sessioin_id or the GET method passes session_id, the key value needs to be used. Their formats are Cookie: sess_name=session_id; and /path.php?sess_name=session_id, where sess_name is specified here.

3,session.use_only_cookies = 0

means only using the Cookie method to pass the session id. We have said that in addition to cookies, there is also the GET method for passing cookies. The GET method is an unsafe method. When cookies are disabled on the user side, the GET method will be used to pass the session_id. You can use this setting to pass the session_id using the GET method.

4, session.cookie_lifetime = 0, session.cookie_path = / and session.cookie_domain =
If you use the Cookie method to pass session_id, the cookie valid domain, directory and time are specified here. Corresponding to the formal parameters $expire, $path and $domain of the setcookie() function respectively. Among them, cookie_lifetime=0 means that the cookie will not be deleted until the browser is closed. These values ​​can also be modified using the session_set_cookie_params() function.

5,session_name([string $name])

Get or update session_name. If name is passed, it means that the default name PHPSESSID (specified by session.name) is not used, otherwise the current session_name is obtained. Note: If session_name is set, it must be called before session_start() to take effect.

6,session_id([string $id])

Similar to session_name(), but it is a method to read or set session_id. Similarly, if session_id is set, it must be called before session_start() to be effective.

7, session_set_cookie_params() and session_get_cookie_params()

Three php.ini settings of session.cookie_lifetime, session.cookie_path and session.cookie_domain can be reset through session_set_cookie_params(). And session_get_cookie_params() gets the values ​​of these settings

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632844.htmlTechArticleThis article will introduce you to the detailed configuration of session and cookie in php.ini. I hope this tutorial will be useful to all students. will help. 1,session.use_cookie = 1 Whether to use Cookie method to pass...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn