我有一個PHP腳本的作品,除了我得到這個錯誤信息PHP數組作爲索引,而不陣列
Undefined index: Array in [...]/exp.php on line 239
在此行中有這樣的代碼很細:
$out_kostenstelle = $kostenstellen[$nextShift["kostenstelle"]][1].
"(".$nextShift["kostenstelle"].")";
我覺得僅作爲索引的陣列可以發生的部分是$nextShift["kostenstelle"]
是$kostenstellen
的索引的部分。
然而,當我試圖抓住這一部分(它與好幾百個運行一個循環,所以我不能手動檢查),此代碼,我的劇本從來沒有進入if
條款內的部分
if(is_array($nextShift["kostenstelle"]))
{
echo "<pre>";
var_dump($nextShift);
echo "</pre>";
die();
}
這對我沒有任何意義,我嘗試了很多東西。沒有成功。
我認爲這可能是足夠的代碼,其中的誤差可能,但萬一這裏是$kostenstellen
結構和$nextShift
Kostenstellen:
array(2) {
[100]=>
array(2) {
[0]=>
string(3) "100"
[1]=>
string(11) "Company A"
}
[200]=>
array(2) {
[0]=>
string(3) "300"
[1]=>
string(12) "Company B"
}
}
和nextShift:
array(4) {
["id"]=>
string(2) "168"
["start_unix"]=>
string(10) "1466780000"
["end_unix"]=>
string(10) "1466812400"
["kostenstelle"]=>
string(3) "100"
}
你把你的'is_array'檢查只是* *前的故障點? – BeetleJuice
只是做了它,它什麼也沒有改變 – JRsz