输出缓冲在图片标记周围插入双引号。如何解决这个问题。
我有htmlToBeInserted.html
个文件,内容为:
<noscript><picture class="slider2pict remJs" own-display="inline-block" >
<source media="(min-width: 320px)" srcset="https://typejoy.biz/exm/book/book170722/public/img/imgSlider/red366sel/0_0_IMG_20170418_112243_M320.webp" type="image/webp" comment="actually code is longer" /> </picture></noscript><img src="https://typejoy.biz/exm/book/book170722/public/img/testJpg.jpg" comment="actually code is longer" />
我将此文件插入output.php
ob_start();
include ( $v['filename'] );
$imgStr = ob_get_contents();
ob_end_clean();
echo $imgStr;
结果在图片元素周围包含额外的引号,因此图片被理解为一段文字而不是普通的html。怎么会发生?
<noscript>"<picture .... </picture>"</noscript><img .... />
答案 0 :(得分:0)
似乎这是Google Chrome的默认行为,如果启用了java脚本,则无脚本标记内的所有内容都会被双引号。如果我在chrome中禁用JavaScript,则双引号会消失。