所以我有这段代码:foreach($xml->PrintQuestionas$PrintQuestion){//ifhintdoesn'texist,storequestionidif(!$PrintQuestion->content->multichoice->feedback->hint->Passage){fwrite($fp,"".$PrintQuestion->attributes()->id."");}}基本上,如果Passage节点存在,我会尝试将ID保存到XML文件中,但它似乎正在存储每个ID,无论节点是否存在于Passage或不是。 最佳答