我在使用Dom读xml文件时遇到一个问题,就是当123.xml文件不存在时,load(123.xml)就报错,怎么样才能判断这个文件是否存在啊,我要的是存在时就读取,不存在就跳过,继续的读下一个xml,请教各位大侠,$filename="http://xxx.com/123.xml";
$xml = new DomDocument('1.0');
if($xml->load($filename)){
.......................................
}
$xml = new DomDocument('1.0');
if($xml->load($filename)){
.......................................
}
{
//load
}
else
{
}
$xml = new DomDocument('1.0');
if($xml->loadXML(file_get_contents($filename))){
.......................................
}