Can i set session variables based on the variable input into the function. Such as:
function check($value){
$_SESSION['$value'];
//session checks
}
Yes, but it would have to be $_SESSION[$value]
. Single quoted strings are literal and do not have variable substitution (not that quotes are even needed in this case).
usually you would use a key and a value, depends what you're trying to do i guess and what $value
is
function check($value){
$_SESSION[$value] = $value;
//session checks
}
做就是了:
$_SESSION[$value]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.