我想访问数组的值。访问数组中的值php
Array ([0] => stdClass Object ([action_type] => comment [value] => 19074.125) [1] => stdClass Object ([action_type] => like [value] => 2179.9) [2] => stdClass Object ([action_type] => link_click [value] => 16.633202528886) [3] => stdClass Object ([action_type] => offsite_conversion.fb_pixel_add_to_cart [value] => 451.45857988166) [4] => stdClass Object ([action_type] => offsite_conversion.fb_pixel_complete_registration [value] => 897.60588235294) [5] => stdClass Object ([action_type] => offsite_conversion.fb_pixel_initiate_checkout [value] => 1230.5887096774) [6] => stdClass Object ([action_type] => offsite_conversion.fb_pixel_lead [value] => 372.17804878049) [7] => stdClass Object ([action_type] => offsite_conversion.fb_pixel_purchase [value] => 2384.265625) [8] => stdClass Object ([action_type] => offsite_conversion.fb_pixel_view_content [value] => 63.316597510373) [9] => stdClass Object ([action_type] => post [value] => 8477.3888888889) [10] => stdClass Object ([action_type] => post_like [value] => 193.15569620253) [11] => stdClass Object ([action_type] => unlike [value] => 76296.5) [12] => stdClass Object ([action_type] => page_engagement [value] => 15.168290258449) [13] => stdClass Object ([action_type] => post_engagement [value] => 15.274574574575) [14] => stdClass Object ([action_type] => offsite_conversion [value] => 43.39960182025))
我需要访问的[ACTION_TYPE]的值=> offsite_conversion.fb_pixel_purchase [值] => 2384.265625,如何获得的仅offsite_conversion.fb_pixel_purchase的值Δα
这些值来自foreach循环。您正在看到的数组是print_r($ x)。
你为什么JSON编码和解码,然后...?! – deceze
可能是'echo $ key [0] - > action_type;' – feeela
@deceze如果我回显出$ r,我会将Array转换为字符串转换错误! –