I am using the following PHP code...
$settings[] = get_app_settings();
echo $settings['weight_unit'];
but its throwing error 'undefined index'.
and when i do print_r($settings);
it generates following...
Array ( [0] => Array ( [support_email] => info@domain.com [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 ) )
Why is it not returning a value for $settings['weight_unit'];
?
its solved by removing []
(array) from $settings
. thanks anyways.
Try $settings = get_app_settings();
- you probably want to assign the returned array directly and not to a new array element in $settings
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.