PHP调用Http短信接口(返回值为xml),在PHP中如何提取出来里面的值?
使用 simplexml_load_string函数就可以了,例子程序代码:
<?源源码appinventor源码下载php
$string = <<<XML
<?xml version="1.0" encoding="utf-8" ?>
<returnsms>
<returnstatus>status</returnstatus>
<message>message</message>
</returnsms>
XML;
$xml = simplexml_load_string($string);
echo 'returnstatus:',$xml->returnstatus,"\n";
echo 'message:',$xml->message,"\n";
print_r($xml);
>2024-11-30 23:31
2024-11-30 22:33
2024-11-30 22:16
2024-11-30 21:52
2024-11-30 21:40