use*_*185 4 php iframe preg-match
我试图在我的帖子中过滤掉iframe,我的帖子看起来像这样
<!--videoplayer--><iframe title="YouTube video player" class="youtube-player" type="text/html" width="200" height="200" src="http://www.youtube.com/embed/IIYeKGNNNf4?rel=0" frameborder="0" allowFullScreen></iframe><!--endvideoplayer-->Blitz performs at Desifest 2010 in Toronto Canada, & Films music video with Navin Kundra for the song "Love You The Same" feat Kat Eyez & produced by Roach Killa from Blitz's new album "Get Blitz". Join my fanpage for more: WWW.FACEBOOK.COM/BLITZMUSIC *Special thanks to: Deesha, Dj Jump Off, Paul The Drummer, Surgeon, Umar, Navin Kundra, Nyrone, Sats B, Kat Eyez, B Don. (New Album Coming Soon!)
Run Code Online (Sandbox Code Playgroud)
我只想返回iframe而不是帖子描述,所以从我想要的.
谢谢
Dev*_*oot 14
preg_match('/<iframe.*src=\"(.*)\".*><\/iframe>/isU', $string, $matches);
echo ($matches[0]); //only the <iframe ...></iframe> part
echo ($matches[1]); //the src part. (http://www.youtube.com/embed/IIYeKGNNNf4?rel=0)
Run Code Online (Sandbox Code Playgroud)