<?php $result = setcookie('cookie_name', '这是在site1.domain.com设置的cookie', time() + 3600, '/', '.domain.com'); var_dump($result); // bool(true)
<?php if (isset($_COOKIE['cookie_name'])) { echo $_COOKIE['cookie_name']; // 这是在site1.domain.com设置的cookie } else { echo '$_COOKIE[\'cookie_name\'] 不存在'; }
Copyright © 2024 码农人生. All Rights Reserved