Not sure why but the mailer keeps telling me I dont have an email in there, i know im just accessing it incorrectly
不知道为什么,但邮件一直告诉我,我没有电子邮件,我知道我只是错误地访问它
XML file: `
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);
}
`
`
` I've also tried $XML->schoolData / $school->email
`我也尝试过$ XML-> schoolData / $ school-> email
1 个解决方案
#1
1
Using $school->email works. Tested with this code - http://phpfiddle.org/main/code/fxz-1k6
使用$ school-> email工作。使用此代码进行测试 - http://phpfiddle.org/main/code/fxz-1k6
#1
1
Using $school->email works. Tested with this code - http://phpfiddle.org/main/code/fxz-1k6
使用$ school-> email工作。使用此代码进行测试 - http://phpfiddle.org/main/code/fxz-1k6