0
我解析来自YouTube的简单oembed网址,并将它们转换为xhtml,但是,一些html得到整理(我相信是)不正确。不应该有效的xhtml是allowFullScreen =“true”?????如果这是正确的,是否有一些整洁的模块可以做到这一点?我必须走“净化器”路线吗?来自YouTube整洁xhtml的参数,如allowFullScreen
输入: tidy'ing后
<iframe allowfullscreen ... ></iframe>
最终输出:
<iframe allowfullscreen="" ...></iframe>
PHP整洁:
$tidy = new \tidy();
$config = array(
'show-body-only' => true,
'char-encoding' => 'utf8'
);
$output = $tidy -> repairString($data['html'], $config, 'UTF8');