$xml = '<tag> • </tag>';
$dom = new DOMDocument;
$dom->preserveWhiteSpace = FALSE;
$dom->loadXML($xml);
echo $dom->saveXML();
$ xml是utf8编码的字符串,在将其导出为XML时保存在db中,我收到以下警告:
DomDocument::LoadXML(): Entity 'bull' not defined in Entity
如果使用loadHTML而不是loadXML获得以下警告:
DomDocument::LoadXML(): Entity 'tag' not defined in Entity