Home >Backend Development >PHP Tutorial >Solve the problem that PHP SimpleXML does not support namespace_PHP tutorial
Unfortunately, PHP SimpleXML does not natively support parsing XML data with namespaces. For example, there is xml data of Jiangzi:
Mango Station
I didn’t know how to deal with it, so I felt sick:
$content = "
Mango Station
//Replace string
$content = str_replace('xxx:', '', $content);
//Read the replaced string
$xml = simplexml_load_string($content);
Filter out all namespaces directly through string replacement. Done in an instant, haha!