目前,我正在尝试确定一个房间的油漆成本,
要获得我一直在尝试使用阵列系统的每个房间的价值,
当前在用户添加房间的页面上,我具有此初始数组代码
$_SESSION['rheight'] = $_POST['height'];
$_SESSION['rlength'] = $_POST['length'];
$_SESSION['rwidth'] = $_POST['width'];
$_SESSION['rwindoor'] = $_POST['windoor'];
$_SESSION['rname'] = $_POST['name'];
$_SESSION['rcost'] = $_POST['zoot'];
$_SESSION['rtotal'] = ($_SESSION['rheight'] + $_SESSION['rlength'] + $_SESSION['rwidth'] + (.75 * $_SESSION['rwindoor'])) * $_SESSION['rcost'];
$_SESSION['Thic'] = [];
array_push($_SESSION['room'.count($_SESSION['Thic'])] = [$_SESSION['rname'], $_SESSION['rtotal']];)
然后在输出总成本的页面上,我有
echo $_SESSION['thic'][0]['rname'];
谢谢您的帮助。
答案 0 :(得分:0)
在使用session_start()
超全局变量之前,您需要调用$_SESSION
函数。