Php simplexml\u加载\u文件-加载xml文件失败
我试图在命令行数据上对XML进行一些非常基本的解析,但失败得很惨 在php文件的同一目录中找到的xml文件,以下是xmlPhp simplexml\u加载\u文件-加载xml文件失败,php,simplexml,Php,Simplexml,我试图在命令行数据上对XML进行一些非常基本的解析,但失败得很惨 在php文件的同一目录中找到的xml文件,以下是xml <?xml version="1.0"?> <company> <employee> <firstname>Tom</firstname> <lastname>Cruise</lastname> <designation>MD</designati
<?xml version="1.0"?>
<company>
<employee>
<firstname>Tom</firstname>
<lastname>Cruise</lastname>
<designation>MD</designation>
<salary>500000</salary>
</employee>
<employee>
<firstname>Tyler</firstname>
<lastname>Horne</lastname>
<designation>CEO</designation>
<salary>250000</salary>
</employee>
</company>
我明白了
布尔(真)
加载失败
我尝试使用斜杠和反斜杠来使用xml文件的完整路径,但总是得到同样糟糕的结果,尽管php确认它是一个文件忘记了在使用“simplexml\u load\u string”时它工作得很好
<?php
var_dump(is_file("employees.xml"));
$xmldata = simplexml_load_file("employees.xml") or die("Failed to load");
echo $xmldata->employee[0]->firstname . "<\n>";
echo $xmldata->employee[1]->firstname;
?>
"c:\program files\iis express\PHP\v7.2\php.exe" loademployees.php