0
我在Laravel 4.2上使用mewebstudio/Purifier
程序包服務提供商HTMLPurifier。允許YouTube在Laravel 4和mewebstudio/Purifier上嵌入HTMLPurifier
由於某些原因,我無法使youtube iframe功能正常工作。我甚至嘗試過作者的例子,使它沒有運氣。
這是我HTMLPurifier捆綁配置:
return array(
'encoding' => 'UTF-8',
'finalize' => true,
'preload' => false,
'settings' => array(
'default' => array(
'HTML.Doctype' => 'XHTML 1.0 Strict',
'HTML.Allowed' => 'div[style],b,strong,i,em,a[href|title|style],ul,ol,li,p[style],br,span[style],
img[width|height|alt|src],h1[style],h2[style],h3[style],h4[style],h5[style],table[class|style|summary],tr,td[abbr],tbody,thead',
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
'HTML.SafeObject' => true,
'Output.FlashCompat' => true,
'HTML.SafeIframe' => true,
'URI.SafeIframeRegexp' => '%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/)%',
'AutoFormat.AutoParagraph' => true,
'AutoFormat.RemoveEmpty' => true,
'HTML.Nofollow' => true,
'URI.Host' => 'domain.com',
),
),
);
這是我的路線測試:
Route::get('/clean', function() {
$pured = Purifier::clean('<iframe src="//www.youtube.com/embed/gLUdqi8J0mQ" width="640" height="360" frameborder="0"></iframe>', 'default');
return $pured;
});
其他一切作品,但這個。
感謝同胞的戰士:)
試過它已經,沒有工作:/ –
它在這裏也不起作用。 –