PHP Cookie

Setting a Session Cookie

<?php setcookie('Cookie_Name','value'); ?>

Setting a Persistent Cookie

<?php setcookie('Cookie_Name','value', mktime(12,0,0,08,22,2016) ); ?>

Reading a Cookie

<?php echo $_COOKIE['Cookie_Name']; ?>

 Deleting the Cookies

<?php setcookie('Cookie_Name',''); ?>

<?php setcookie('Cookie_Name','', mktime(12,0,0,11,22,1970) ); ?>

 Other Optional Paramters

Path, Domain, and Secure parameters can also be set to restrict a cookie to a certain path, domain or in the case of the Secure parameter, limit the cookie to only be set if the request came in over an SSL connection.


Loading ...

Related Results :

  1. GET / POST / Cookie / Request / Server / Files / Session
  2. PHP Cookie
Note :
  • Related Posts are generally User Blog posts.
  • or Other tutorials from other networks of w3clan.com.
  • Any registered user can create related posts based on search term tags.

About the Author