2013-07-23 131 views
0

Hotmail的天才决定混合使用单个'和双引号"来获取lulz的HTML电子邮件中的属性。这不必要地过度复杂化,因为我试图在某些情况下为body元素获取类和id以将其从CSS选择器中移除。做一个基本的字符串替换显然不是一个选项。PHP用双引号替换属性单引号

回答

0

我意识到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();