$xml_document_weizhi = stripos($xml, '<w:body>');
$xml_document = substr($xml, 0, $xml_document_weizhi);
$mml_arrs= [];
libxml_disable_entity_loader(false);
preg_replace_callback('/(<m:oMath>)([\s\S]*?)(<\/m:oMath>)/', function ($matches) use ($xml_document,&$mml_arrs) {
$mml =$xml_document.'<w:body><m:oMathPara>' . $matches[0] . '</m:oMathPara></w:body></w:document>';
$domDocument = new DOMDocument();
$domDocument->loadXML($mml);
$numberings = $domDocument->getElementsByTagNameNS('http://schemas.openxmlformats.org/wordprocessingml/2006/main', 'body');
$numberings = $numberings->item(0);
$xsl = new DOMDocument();
$xsl->load('OMML2MML.XSL');
$processor = new XSLTProcessor();
$processor->importStyleSheet($xsl);
$omml = $processor->transformToXML($numberings);
$omml = str_replace('<?xml version="1.0" encoding="UTF-8"?>', '', $omml);
$omml = str_replace('xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"', '', $omml);
$omml = str_replace("mml:", '', $omml);
$omml = str_replace("\n", '', $omml);
$omml = str_replace("<mi mathvariant=\"normal\">'</mi>","<mo mathvariant=\"normal\">'</mo>",$omml);
$omml = str_replace("<mi>'</mi>","<mo>'</mo>",$omml);
$omml = str_replace("<mo>'</mo>","<msup><mi></mi><mo>'</mo></msup>",$omml);
$omml = preg_replace('/<mi>([\x{4e00}-\x{9fa5}]+)<\/mi>/isu','<mo>$1</mo>',$omml);
$mml_arrs[] = $omml;
return "";
}, $xml);