📜  php代码示例中的setcookie

📅  最后修改于: 2022-03-11 14:53:47.539000             🧑  作者: Mango

代码示例3
// PHP <7.0
if (isset($_COOKIE['user'])) {
    // true, cookie is set
    echo 'User is ' . $_COOKIE['user'];
else {
    // false, cookie is not set
    echo 'User is not logged in';
}

// PHP 7.0+
echo 'User is ' . $_COOKIE['user'] ?? 'User is not logged in';