我有一個很短的(到目前爲止),非常基本的XML文件名爲config.xml中像PHP的SimpleXML忽略XML(有點)
<?xml version='1.0' encoding='UTF-8' ?>
<name_of_program3>
<path_to_exe3>script.pl</path_to_exe3>
<path_to_perl>/usr/bin/perl</path_to_perl>
<temp_output_file>temp.txt</temp_output_file>
</name_of_program3>
我想用下面的PHP來閱讀:
$config = simplexml_load_file('config.xml');
$exe = $config->name_of_program3->path_to_exe3;
$perl_exec = $config->name_of_program3->path_to_perl;
$temp_file = $config->name_of_program3->temp_output_file;
沒有讀取任何XML元素; $exe
,$perl_exec
和$temp_file
都是空的,但是打印$config
和$config->asXML()
表明XML實際上存在。
請告訴我我正在做一些愚蠢的事情,這樣我就可以停止將我的頭撞到我的桌子上。 :)
對不起,投下去,爲什麼? – dmn