Echoing session variables in php
This question already has an answer here:
Inside a double-quoted string you must enclose a complex variable (array or object property) in {}
:
<p><?php echo("{$_SESSION['test']}"."<br />");?></p>
This isn't an issue with $_SESSION
specifically, but any array accessed by quoted keys. Note, that you can include a numerically indexed array value with wrapping in {}
, as in "echo $array[2] is two";
上一篇: PHP:致命错误:调用非成员函数
下一篇: 在php中回显会话变量