PHP 读取 XML中指定内容
<returnsms><returnstatus>Success</returnstatus><message>ok</message><remainpoint>-437...
<returnsms>
<returnstatus>Success</returnstatus>
<message>ok</message>
<remainpoint>-43779</remainpoint>
<taskid>496370</taskid>
</returnsms>
这不是XML文件,是短信返回的字符串,但是我想要 里面的数据 如 :Success、ok等 展开
<returnstatus>Success</returnstatus>
<message>ok</message>
<remainpoint>-43779</remainpoint>
<taskid>496370</taskid>
</returnsms>
这不是XML文件,是短信返回的字符串,但是我想要 里面的数据 如 :Success、ok等 展开
1个回答
展开全部
$xml = "<returnsms><returnstatus>Success</returnstatus><message>ok</message><remainpoint>-43779</remainpoint> <taskid>496370</taskid></returnsms>";
$ob = simplexml_load_string($xml);
echo "returnstatus is:".$ob->returnstatus;
echo "<br />";
echo "message is:".$ob->message;
echo "<br />";
echo "remainpoint is:".$ob->remainpoint;
echo "<br />";
echo "taskid is:".$ob->taskid;
//var_dump($ob);
//用simplexml_load_string()函数来解析
$ob = simplexml_load_string($xml);
echo "returnstatus is:".$ob->returnstatus;
echo "<br />";
echo "message is:".$ob->message;
echo "<br />";
echo "remainpoint is:".$ob->remainpoint;
echo "<br />";
echo "taskid is:".$ob->taskid;
//var_dump($ob);
//用simplexml_load_string()函数来解析
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询