Как получить элементы массива конкретного ключа из ассоциативного массива в следующем сценарии?

Я на ассоциативном массиве под названием $group_list, Когда я печатаю это с помощью print_r($grouop_list) печатает следующий контент:

Pages_Component_Controller_List Object
(
[data] => Array
(
[0] => Array
(
[vanity_url] =>
[page_type] => 1
[category_name] => Athletic
[profile_server_id] => 0
[profile_user_image] =>
[is_liked] => 592
[page_id] => 174
[app_id] => 0
[view_id] => 0
[type_id] => 7
[category_id] => 170
[user_id] => 244
[title] => Olympic Games
[code] =>
[unv_title] => 1398
[campus_name] => Mississippi State University, Meridian
[group_type] => close
[reg_method] => 0
[landing_page] => wall
[time_stamp] => 1423362356
[image_path] =>
[image_server_id] => 0
[total_like] => 1
[total_dislike] => 0
[total_comment] => 0
[privacy] => 0
[designer_style_id] => 0
[cover_photo_id] =>
[cover_photo_position] =>
[location_latitude] =>
[location_longitude] =>
[location_name] =>
[use_timeline] => 0
[classroom] =>
[time_class] =>
[num_weeks] =>
[country_iso] => MS
[term] =>
[year] => 2015
[profile_page_id] => 0
[user_server_id] => 0
[user_name] => profile-244
[full_name] => Campusknot .
[gender] => 0
[user_image] => 2015/02/ade52764529ccd469bbddf98aa62712c%s.jpg
[is_invisible] => 0
[user_group_id] => 7
[language_id] =>
[link] => http://54.174.50.242/group/174/
[aFeed] => Array
(
[feed_display] => mini
[comment_type_id] => pages
[privacy] => 0
[comment_privacy] => 0
[like_type_id] => pages
[feed_is_liked] => 592
[feed_is_friend] =>
[item_id] => 174
[user_id] => 244
[total_comment] => 0
[feed_total_like] => 1
[total_like] => 1
[feed_link] => http://54.174.50.242/group/174/
[feed_title] => Olympic Games
[type_id] => pages
)

)

[1] => Array
(
[vanity_url] =>
[page_type] => 1
[category_name] => Academic
[profile_server_id] => 0
[profile_user_image] =>
[is_liked] =>
[page_id] => 170
[app_id] => 0
[view_id] => 0
[type_id] => 7
[category_id] => 169
[user_id] => 244
[title] => Master of Engineering
[code] => ME
[unv_title] => 1398
[campus_name] =>
[group_type] => close
[reg_method] => 0
[landing_page] => wall
[time_stamp] => 1421152531
[image_path] =>
[image_server_id] => 0
[total_like] => 0
[total_dislike] => 0
[total_comment] => 0
[privacy] => 0
[designer_style_id] => 0
[cover_photo_id] =>
[cover_photo_position] =>
[location_latitude] =>
[location_longitude] =>
[location_name] =>
[use_timeline] => 0
[classroom] => traditional
[time_class] => 01:10 AM-04:00 AM
[num_weeks] => Mon-Sat
[country_iso] => MS
[term] => fall
[year] => 2015
[profile_page_id] => 0
[user_server_id] => 0
[user_name] => profile-244
[full_name] => Campusknot .
[gender] => 0
[user_image] => 2015/02/ade52764529ccd469bbddf98aa62712c%s.jpg
[is_invisible] => 0
[user_group_id] => 7
[language_id] =>
[link] => http://54.174.50.242/group/170/
[aFeed] => Array
(
[feed_display] => mini
[comment_type_id] => pages
[privacy] => 0
[comment_privacy] => 0
[like_type_id] => pages
[feed_is_liked] =>
[feed_is_friend] =>
[item_id] => 170
[user_id] => 244
[total_comment] => 0
[feed_total_like] => 0
[total_like] => 0
[feed_link] => http://54.174.50.242/group/170/
[feed_title] => Master of Engineering
[type_id] => pages
))
)
[_sModule:Phpfox_Component:private] => pages
[_sComponent:Phpfox_Component:private] => controller/list
[_sCacheVar:Phpfox_Component:private] =>
)

На самом деле я хочу, чтобы все элементы массива принадлежали только ключу данных. Как я должен получить эти данные?

Пожалуйста, помогите мне.

Благодарю.

0

Решение

Ваш $group_list скорее всего, не массив, а действительно объект.

Для доступа к массиву данных вы просто используете оператор стрелки (->):

$data = $group_list->data;
1

Другие решения

Попытайся:

echo $ grouop_list [‘data’] [0] -> title;

echo $ grouop_list [‘data’] [0] -> time_stamp;

0

По вопросам рекламы [email protected]