-3

不知道为什么,但邮件一直告诉我我那里没有电子邮件,我知道我只是错误地访问它

XML 文件:`

<?xml version="1.0" encoding="UTF-8"?>
<schools>
    <schoolData>
        <name>Dude</name>
        <schoolName>NA</schoolName>
        <email>sls@gmail.com</email>
        <mascot>Da bears</mascot>
    </schoolData>
    <schoolData>
        <name>Dude2</name>
        <schoolName>gg</schoolName>
        <email>sl3@gmail.com</email>
        <mascot>Muffin</mascot>
    </schoolData>
    <schoolData>
        <name>Dude3</name>
        <schoolName>123</schoolName>
        <email>s1@gmail.com</email>
        <mascot>cheesecakeface</mascot>
    </schoolData>
    <schoolData>
        <name>Dude234</name>
        <schoolName>456</schoolName>
        <email>1@gmail.com</email>
        <mascot>Bob</mascot>
    </schoolData>
</schools>

`

    <?php
$XML = simplexml_load_file('http://domain/hMail/data/list.xml');

foreach ($XML as $school) {
    $mail->AltBody = 'Come see me play Tonight!';
    $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
    $mail->addAddress($school->schoolData->email);
}

`

` 我也试过 $XML->schoolData / $school->email

4

1 回答 1

1

使用 $school->email 有效。使用此代码进行测试 - http://phpfiddle.org/main/code/fxz-1k6

于 2013-10-29T23:24:08.020 回答