PHP transparently supports HTTP cookies. A cookie is a mechanism for storing data on a remote browser to track and identify users. You can use the Setcookie () or Setrawcookie () function to set the cookie. A cookie is part of the HTTP header, so the Setcookie () function must be called before other information is exported to the browser, similar to the limit on the header () function. You can use the output buffering function to delay the output of the script until all cookies or other HTTP headers are set as needed. Example #1 Setcookie () use example <?php $value = ' something from somewhere '; Set Cookie SE
1. PHP features the use of session mechanism 1--cookie
Summary: PHP transparently supports HTTP cookies. A cookie is a mechanism for storing data on a remote browser to track and identify users. You can use the Setcookie () or Setrawcookie () function to set the cookie.
2. In PHP, the value of the cookie is garbled.
Introduction: PHP in the value of cookies garbled problem $username=mb_convert_encoding ($row 1[0], "GBK", "UTF-8"); Setcookie (' username ', $username); This through the Setcookie on the page will appear garbled but through the Setrawcookie will be error, undefined function errors Consult
3. In PHP, the value of the cookie is garbled.
Introduction: PHP in the value of cookies garbled problem $username=mb_convert_encoding ($row 1[0], "GBK", "UTF-8"); Setcookie (' username ', $username); This through the Setcookie on the page will appear garbled but through the Setrawcookie will be error, undefined function errors Consult
4. The difference between Setcookie and Setrawcookie
Description: The difference between Setcookie and Setrawcookie {code ...} Setrawcookie value plus rawurlencode and no difference