0

私はphpで配列の配列を持っています。どちらの配列もインデックスがありません (キーを使用します)。

 $this->confArr["$sectionName"] = Array(); // case 1

これは true を返します。

 isset($this->confArr["$sectionName"]);

$sectionName という名前の要素が既に設定されているためです。

 $this->confArr["$sectionName"]["$itemKey"] = $itemValue; //case 2

理由はわかりませんが、これは常に FALSE を返します

 array_key_exists($itemKey, $this->confArr["$sectionName"]);

どうしたの ?

4

1 に答える 1

0

問題はこれでした:

array_key_exists($itemKey, $this->confArr["$sectionName"]);

次のようにする必要があります。

array_key_exists("$itemKey", $this->confArr["$sectionName"]);

正確な理由はわかりませんが、このように機能しますか?

于 2013-07-18T23:56:23.327 に答える