2012-01-12 18 views
0

与えられた私は...配列は、キー

$settings[] = get_app_settings(); 
echo $settings['weight_unit']; 

が、その投げエラー「未定義のインデックス」を以下のPHPコードを使用していますの値を返していません。

と私は...

Array ([0] => Array ([support_email] => [email protected] [support_phone] => 9812345678 [currency_symbol] => $ [weight_unit] => g. [catalogue_image_width] => 450 [catalogue_image_height] => 675 [single_product_image_width] => 500 [single_product_image_height] => 500 [product_image_width] => 200 [product_image_height] => 200 [tax_rate] => 1 [shipping_charges] => 0)) 

は、なぜそれが$settings['weight_unit'];の値を、それは以下の生成print_r($settings);戻っていないのですか?

答えて

2

[](配列)を$settingsから削除して解決しました。とにかく、ありがとう。

1

お試し$settings = get_app_settings(); - 返された配列を直接割り当て、$settingsの新しい配列要素には割り当てないことをお勧めします。

+0

それは間違いでした。申し訳ありません。 – seoppc

関連する問題