的一部分,我有一個會議看起來像這樣:覆蓋會話
array(1) {
[31]=>
array(10) {
["aantal"]=>
int(1)
["id"]=>
string(2) "31"
["filmtitel"]=>
string(16) "2_fast_2_furious"
["film_id"]=>
string(1) "1"
["zaal_id"]=>
string(1) "1"
["dag"]=>
string(8) "woensdag"
["zaaltitel"]=>
string(6) "zaal 1"
["tijdstip"]=>
string(8) "17:30:00"
["stoeltjes"]=>
array(3) {
[0]=>
string(2) "20"
[1]=>
string(2) "21"
[2]=>
string(2) "22"
}
["aantalStoeltjes"]=>
string(3) "150"
}
}
我的問題是,我怎麼能覆蓋的["stoeltjes"]
的內容?
當我這樣做unset($_SESSION['addToCart'][$id]["stoeltjes"]);
然後["stoeltjes"]
被刪除,但是當我添加其他值它們會放在stoeltjes陣列內的額外陣列。
我給你的新值屁股下面:$_SESSION["addToCart"][$id]["stoeltjes"][] = $seats;
你能告訴我們的代碼,你打算值賦給$ _SESSION陣列的其他指標?另外,var_dump中沒有'addToCart'索引,它來自哪裏? – erisco 2010-08-29 15:28:31
你可以編輯你的文章,並添加代碼如何分配新值。 – Youssef 2010-08-29 15:31:24
@erisco,只是因爲我vardumped的內容addToCart – vincent 2010-08-29 15:39:40