嵌入视频的preg_replace代码有什么错?

时间:2019-12-09 13:50:28

标签: php iframe preg-replace embed

我正在尝试直接从链接中嵌入视频

链接示例

https://www.example.com/video22818393/dancing_with_the_moon

标准嵌入代码:

<iframe src="https://www.example.com/embedframe/22818393" frameborder=0 width=510 height=400 scrolling=no allowfullscreen=allowfullscreen></iframe>

我的代码,可直接从链接嵌入视频:

$post[message] = preg_replace('/<a href="https?:\/\/www\.example\.com\/video([a-z0-9A-Z]+)\/([a-z0-9A-Z]+)" target="_blank">(.+?)<\/a>/', '<iframe src="https://www.example.com/embedframe/$1" frameborder=0 width=510 height=400 scrolling=no allowfullscreen=allowfullscreen></iframe>', $post[message]);

但是使用此代码仅显示站点链接而不是视频,那么有人知道我做错了吗?

0 个答案:

没有答案
相关问题