Home >Backend Development >PHP Tutorial >Introduction to the usage of setcookie() function in php_PHP tutorial
The setcookie() function is a function in PHP that is used to set cookie values. Let me summarize the specific usage of the setcookie() function and how to obtain the cookie value after setting it.
The setcookie() function sends an HTTP cookie to the client.
A cookie is a variable sent by the server to the browser. Cookies are typically small text files that a server embeds on a user's computer. This cookie is sent each time the computer requests a page through the browser.
The name of the cookie is specified as a variable of the same name. For example, if the cookie being sent is named "name", a variable named $user is automatically created containing the cookie's value.
The cookie must be assigned before any other output is sent.
The function returns true if successful, false otherwise.
Grammar
setcookie(name,value,expire,path,domain,secure)
Example
The code is as follows | Copy code | ||||
n"; } } |
js获取 cookie方法
代码如下
|
复制代码 | ||||