我试图访问这个PHP数组没有运气,我想访问[icon] => icon.png
Array ( [total] => 2
[total_grouped] => 2
[notifys] => Array ( [0] => Array ( [notifytype_id] => 12
[grouped] => 930
[icon] => icon.png
[n_url] => wall_action.php?id=930
[desc] => 690706096
[text] => Array ( [0] => Sarah O'conner ) [total] => 1 )))
Run Code Online (Sandbox Code Playgroud)
$arr['notifys'][0]['icon']
Run Code Online (Sandbox Code Playgroud)
ETA:我不确定您的评论意味着什么,以下代码:
$arr = array('total'=>2, 'total_grouped' => 2, 'notifys' => array(array(
'notifytype_id' => 12, 'icon' => 'icon.png')));
echo '<pre>';
print_r($arr);
echo '</pre>';
var_dump($arr['notifys'][0]['icon']);
Run Code Online (Sandbox Code Playgroud)
输出:
Array
(
[total] => 2
[total_grouped] => 2
[notifys] => Array
(
[0] => Array
(
[notifytype_id] => 12
[icon] => icon.png
)
)
)
string(8) "icon.png"
Run Code Online (Sandbox Code Playgroud)
通常,代码从不输出任何内容.您应该开发所有错误和通知.