如何将字符串放入会话中?
为。例如:$_SESSION_[$questioncounter+'question'] = $accepted;
如果为_$questioncounter = 2_,则表示$_SESSION_['2question']
发布于 2014-08-09 14:07:59
使用.(点)连接字符串和变量,并从$_SESSION_ try中删除_
$_SESSION[$questioncounter.'question'] = $accepted;所以完整的代码:
<?php
session_start();
$questioncounter = 2;
$accepted = 'yes';
$_SESSION[$questioncounter.'question'] = $accepted;
echo $_SESSION['2question'];  // yes
?>https://stackoverflow.com/questions/25215720
复制相似问题