1
我需要從xml中獲取「joinmeetingurl」元素的值。我試圖以下面的方式。但它什麼都沒有返回。請幫我取值。從XML對象提取值?
<?php
$xml = '<serv:message xmlns:serv="http://www.webex.com/schemas/2002/06/service"
xmlns:com="http://www.webex.com/schemas/2002/06/common"
xmlns:meet="http://www.webex.com/schemas/2002/06/service/meeting"
xmlns:att="http://www.webex.com/schemas/2002/06/service/attendee">
<serv:header>
<serv:response>
<serv:result>SUCCESS</serv:result>
<serv:gsbstatus>PRIMARY</serv:gsbstatus>
</serv:response>
</serv:header>
<serv:body>
<serv:bodycontent xsi:type="meet:getjoinurlMeetingResponse"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<meet:joinmeetingurl>meetingURL</meet:joinmeetingurl>
</serv:bodycontent>
</serv:body>
</serv:message>';
$xml = simplexml_load_string($xml);
$items = $xml->registerXPathNamespace('meet','http://www.webex.com/schemas/2002/06/service/meeting');
$resp = $xml->xpath('//meet:joinmeetingurl');
?>
我總是獲得$ resp的空值。