代码

/**
 * php 判断返回的内容是不是xml格式的
 */
function iss_xml($content)
{
    //判断返回的内容是不是 xml 格式
    $xml_parser = xml_parser_create();
    $res = xml_parse($xml_parser, $content, true);
    xml_parser_free($xml_parser);
    return $res;
}

if (iss_xml("xml数据")) {
    echo "真";
} else {
    echo "假";
}
最后修改:2020 年 02 月 02 日
如果觉得我的文章对你有用,请随意赞赏