Hotmail的天才们决定在lulz的HTML电子邮件中混合使用单引号'
和双引号"
作为属性。这不必要地使事情过于复杂,因为在某些情况下,我试图获取body元素的类和id,以将其从CSS选择器中删除。在这里,进行基本字符串替换显然不是一种选择。
我意识到PHP的DOMDocument类会自动执行此操作。。。
libxml_use_internal_errors(true); //use this to prevent warning messages from displaying because of the bad HTML
$html = new DOMDocument();//'1.0','UTF-8'
$html->xmlStandalone = false;
$html->loadHTML($b);
$b = $html->saveXML();