Configuration and Application of PHP Cookies

<?php
header('Content-Type: text/html; charset=utf-8');

//Set Cookie, valid for one hour
setcookie('website','onestopweb.iteye.com',time()+3600);

// Determine if the cookie exists
if(isset($_COOKIE['website'])){
    // output the cookie
    echo 'The cookie exists: '.$_COOKIE['website'].'<br>';
}else{
    echo 'The cookie does not exist'.'<br>';
}

//Delete the cookie, set the expiration time to the past one hour
//setcookie('website','',time()-3600);

 

Effect picture:

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326716974&siteId=291194637