如何在此数组中获取user_login
,email
等键的值
我尝试了foreach
,array keys
,array['user_login']
,但没有得到这些值。
我在wordpress工作。 print_r
以这种方式打印数组数据
$array=$_SESSION;
print_r($array);
数组([userdata] => __PHP_Incomplete_Class对象( [__PHP_Incomplete_Class_Name] => WP_User [data] => stdClass对象( [ID] => 1 [user_login] => admin [user_pass] => $ P $ BZzVW3B4g2f6pgocN3iu9h4J0CFmCj1 [user_nicename] =>管理 [user_email] => abc@gmail.com [user_url] => [user_registered] => 2013-05-22 02:21:09 [user_activation_key] => [user_status] => 0 [display_name] => admin)[ID] => 1 [caps] =>数组([管理员] => 1)[cap_key] => wp_capabilities [roles] =>数组([0] =>管理员)[allcaps] =>数组([switch_themes] => 1 [edit_themes] => 1 [activate_plugins] => 1 [edit_plugins] => 1 [edit_users] => 1 [edit_files] => 1 [manage_options] => 1 [moderate_comments] => 1 [manage_categories] => 1 [manage_links] => 1 [upload_files] => 1 [import] => 1 [unfiltered_html] => 1 [edit_posts] => 1 [edit_others_posts] => 1 [edit_published_posts] => 1 [publish_posts] => 1 [edit_pages] => 1 [read] => 1 [level_10] => 1 [level_9] => 1 [level_8] => 1 [level_7] => 1 [level_6] => 1 [level_5] => 1 [level_4] => 1 [level_3] => 1 [level_2] => 1 [level_1] => 1 [level_0] => 1 [edit_others_pages] => 1 [edit_published_pages] => 1 [publish_pages] => 1 [delete_pages] => 1 [delete_others_pages] => 1 [delete_published_pages] => 1 [delete_posts] => 1 [delete_others_posts] => 1 [delete_published_posts] => 1 [delete_private_posts] => 1 [edit_private_posts] => 1 [read_private_posts] => 1 [delete_private_pages] => 1 [edit_private_pages] => 1 [read_private_pages] => 1 [delete_users] => 1 [create_users] => 1 [unfiltered_upload] => 1 [edit_dashboard] => 1 [update_plugins] => 1 [delete_plugins] => 1 [install_plugins] => 1 [update_themes] => 1 [install_themes] => 1 [update_core] => 1 [list_users] => 1 [remove_users] => 1 [add_users] => 1 [promote_users] => 1 [edit_theme_options] => 1 [delete_themes] => 1 [export] => 1 [simple_tags] => 1 [admin_simple_tags] => 1 [管理员] => 1) [filter] => ))
答案 0 :(得分:0)
你试过吗
$_SESSION>userdata('user_login');
要检索您的user_login?