这个数组的回声值?

时间:2013-12-07 02:32:18

标签: php arrays

如何回显此数组的[subject]值?

遇到麻烦:P

IncomingMail Object
(
    [id] => 27
    [date] => 2013-12-06 12:08:29
    [subject] => Re: Final test
    [fromName] => Name
    [fromAddress] => fdgdfg@dfgfdg.me
    [to] => Array
        (
            [fgfdg@dfgfdgdfg.ca] => 
        )

    [toString] => webby@fdgfdgfdg.ca
    [cc] => Array
        (
        )

    [replyTo] => Array
        (
            [dfgfdg@dfgdfg.me] => Name
        )

    [textPlain] => Plain text

    [textHtml] => html

    [attachments:protected] => Array
        (
        )

)

3 个答案:

答案 0 :(得分:2)

这不是一个阵列。这是一个对象。因此,您需要使用->运算符来访问成员变量(因为它们被调用):

echo $objectname->subject;

答案 1 :(得分:1)

jetawe,我认为你的意思是(数组)$ yourObject,而不是数组($ yourObject)

echo $ objectname-> subject;是正确的

答案 2 :(得分:0)

$yourObject = array($yourObject);

$subject = $yourObject['subject'];