我正在尝试更改标记值,但它不成功。这是我的xml格式和php代码,当我使用$ polls-> poll [0] - > person [0] ="更改"时,它工作正常......:
$fname = getPollFile();
$polls = simplexml_load_file($fname);
foreach ($polls->poll as $poll){
foreach($poll->person as $person){
$person = "process";
}
}
$polls->asXML($fname);

<?xml version="1.0" encoding="UTF-8"?>
<polls>
<poll title="Ccccc">
<person id="111">active</person>
<person id="222">active</person>
</poll>
</polls>
&#13;