douyaosi3164 2013-07-23 19:32
浏览 254
已采纳

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

The geniuses at Hotmail decided to mix single ' and double quotes " for attributes in HTML emails for the lulz. This unnecessarily over-complicates things as I'm trying to get the class and id for the body element in some cases to remove it from CSS selectors. Doing a basic string replacement is obviously not an option here.

  • 写回答

1条回答 默认 最新

  • dtnpzghys01643322 2013-07-23 19:32
    关注

    I realized that PHP's DOMDocument class does this automatically...

     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();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题