0
使用的preg_replace作秀视频中,我在YouTube上显示的视频,我使用的preg_replace用于替换任何**link**
到<iframe src="link"></iframe>
当见代码检查元素在Firefox上的HTML代码是正确的,但它不工作,我不知道为什么。我的代码如下。感谢您的帮助或建议。我怎么能在YouTube上
$string = "This is video on youtube **http://www.youtube.com/watch?v=wKTBUmrwYDs**";
$string = preg_replace("/\*\*([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])\*\*/i",'<iframe width="420" height="315" src="$1" frameborder="0" allowfullscreen></iframe>',$string);
echo $string;
而这也行不通。
$string = preg_replace("/\*\*([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])\*\*/i","<object width=\"420\" height=\"315\"><param name=\"movie\" value=\"$1?hl=en_US&version=3&rel=0\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"$1?hl=en_US&version=3&rel=0\" type=\"application/x-shockwave-flash\" width=\"420\" height=\"315\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed></object>",$string);