简体   繁体   English

PHP用双引号替换属性单引号

[英]PHP Replace attribute single quotes with double quotes

在Hotmail的天才决定混合单'和双引号"在HTML电子邮件属性为lulz。这就不必要的,因为我试图让body元素的class和id在某些情况下从中删除过复杂的事情CSS选择器,在这里显然不能进行基本的字符串替换。

I realized that PHP's DOMDocument class does this automatically... 我意识到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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM