PHP setcookie () function

time:15-11-16 forum:PHP tools and code
  http://www.cnblogs.com/xiaochaohuasheng... 46282.html

definition and usage

cookie is a variable sent to the browser by the server. Cookie is usually a small text file embedded in the user's computer by the server. Every time a computer requests a page through a browser, it sends the cookie. The name of

cookie is specified as a variable of the same name. For example, if the cookie being sent is called.Quot; name.quot, it will automatically create a variable called $user, which contains the value of cookie.

must assign cookie before any other output is sent. If

is successful, the function returns true, otherwise it returns false.
syntax

[code]setcookie (name, value, expire, path, domain, secure) [/code]
> / > parameter description is necessary. Specify the name of cookie.
value is necessary. Specify the value of cookie.
expire is optional. The period of validity of cookie is stipulated.
path is optional. The server path of the cookie is specified.
domain is optional. Specify the domain name of cookie.
secure is optional. Specifies whether cookie can be transmitted through secure HTTPS connections.
prompt and annotate

notes: you can access the value of.Quot; user.quot; user.quot; user.quot; cookie; user.quot; $HTTP_COOKIE_VARS[.quot; user.quot; or $_COOKIE[.quot; user.quot;].

note: when sending cookie, the value of cookie will be automatically encoded by URL. URL decoding is performed when receiving. If you do not need this, you can use setrawcookie () instead.
  • 2

prev:Discuz classic PHP encryption decryption... next:Thanks to the deterioration of the milk ...
post comment
Notice



approved   The 78 year old academician sits on ...   1978 Henan arts champion Liu Zhenyun...   Looking for the most beautiful filia...   Brachless college students play game...   The most inspirational live street "...
rand   The solution of reading TXT Chinese ...   Lightweight CMS   PHP Live Chat Pro online customer se...   Free high load, commercial and copyr...   One to one substitution of the PHP a...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com