我想将 $_SESSION 变量的名称设置为另一个变量的值。例如
$var = "123";
$_SESSION['$var'] = "yes";
echo $_SESSION['123']; // Would like to echo "yes"
echo $_SESSION['$var']; // Would also like to echo "yes"
我执行了一个 vardump($_SESSION) 并且会话变量实际上设置为“$_SESSION[$var]”。我怎样才能达到我需要的结果?
非常感谢。