xml屬性在XML輸入反應低於訪問使用PHP
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1</int>
</lst>
<lst name="initArgs">
<lst name="defaults">
<str name="config">../conf/dataconfig.xml</str>
</lst>
</lst>
<str name="status">busy</str>
<str name="importResponse">A command is still running...</str>
<lst name="statusMessages">
<str name="Time Elapsed">0:0:7.942</str>
<str name="Total Requests made to DataSource">1</str>
<str name="Total Rows Fetched">8831</str>
<str name="Total Documents Processed">8830</str>
<str name="Total Documents Skipped">0</str>
<str name="Full Dump Started">2013-06-03 22:15:11</str>
</lst>
<str name="WARNING">
This response format is experimental. It is likely to change in the future.
</str>
</response>
我需要訪問兩個值:下面
<str name="status">busy</str> -- busy
<str name="Total Rows Fetched">8831</str> -- 8831
使用代碼:
$xml = simplexml_load_string($string);
echo $xml->str[0];
我能夠訪問值「忙」但我不知道如何訪問「8831」。
需要解決? –
是的,它的SimpleXML,看到我的編輯。 – michi
真棒解決方案....頭離 –