我想做以下事情:
$_SESSION['SESS_VERSION'] = $member['Version'];
session_write_close();
header("location: '$_SESSION['SESS_VERSION']'");
exit();
现在我得到了:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
如何在字符串中获取此值?
答案 0 :(得分:4)
正确连接字符串:
header('location: '.$_SESSION['SESS_VERSION']);
OR
header("location: {$_SESSION['SESS_VERSION']}");
<强>文档强>
答案 1 :(得分:1)
删除会话周围的引号,例如
$sess = $_SESSION['SESS_VERSION'];
header("location: $sess");
或者你可以这样做,
header("location:". $_SESSION['SESS_VERSION']);