如何检查$xml
是否有子"学生"?
我使用SimpleXML在php:中使用Xml
$xml = simplexml_load_file('log.xml');
提前谢谢。
您可以对使用简单的isset()调用
$node = new SimpleXMLElement('<foo><students>test</students></foo>');
var_dump(isset($node->students));
布尔(真)
if( isset($xml->students) )
// Do