在PHP中访问多维数组的语法问题

时间:2014-03-11 16:26:13

标签: php arrays

在尝试访问此数组中的值时,我很难获得正确的语法。这是数组,之后我将向您展示我尝试过的内容。

[_POST] => Array
(
    [type] => subscribe
    [fired_at] => 2014-03-11 16:15:11
    [data] => Array
        (
            [id] => a23a8866cd
            [email] => mccoym@sportdirections.com
            [email_type] => html
            [ip_opt] => 65.96.140.144
            [ip_signup] => 65.96.140.144
            [web_id] => 145475077
            [merges] => Array
                (
                    [EMAIL] => mccoym@sportdirections.com
                    [FNAME] => Michael
                    [LNAME] => McCoy
                    [MMERGE3] => 10/17
                )

            [list_id] => e375c4fd87
        )

)

我试图获取存储在merges数组中的信息。我试过了:

$_POST['data']->merges['EMAIL']
$_POST['data']->merges->EMAIL
$_POST['data']['merges']->EMAIL

以上工作都没有!任何人都可以帮我解决语法错误吗?

1 个答案:

答案 0 :(得分:5)

尝试:

$_POST['data']['merges']['EMAIL']