Answer the question
In order to leave comments, you need to log in
How to "skip" function arguments?
I want to make the set cookie visible to all site domains, and I know for sure that the function
definitely works, but I don't know how to rewrite it so as not to pass the $expires argument.
setcookie("user", $user["login"], 0 , "/");
Answer the question
In order to leave comments, you need to log in
setcookie
PHP >= 8
Named Arguments
setcookie(
name: 'user',
value: $user["login"],
path: '/'
);
setcookie('user', $user["login"], ['path' => '/']);
function cust_setcookie(
$name,
$value = "",
$path = "/",
$expires = 0,
$domain = "",
$secure = false,
$httponly = false
) {
setcookie($name, $value, $expires, $path, $domain, $secure, $httponly);
}
cust_setcookie('user', $user["login"]);
setcookie('user', $user["login"]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question