php - 我用这个 preg_replace 代码嵌入视频做错了什么?
问题描述
我正在尝试直接从链接嵌入视频
链接示例
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]);
但是这段代码只显示站点链接而不是视频,所以有人知道我做错了什么吗?
解决方案
推荐阅读
- android - Android 图库中的分享按钮
- java - java.lang.ClassNotFoundException:com.netflix.discovery.EurekaClientConfig
- c# - VS2018 WebApi 中的 rdlc:报告定义的目标命名空间无效,无法升级
- firebase - Firebase 显示应用版本需要调查
- azure - 在 OMS 或 Application Insights 中设置渲染时间表的 x 轴时间线
- twitter - Heron 无法为拓扑“WordCountTopology”设置打包计划
- python - 如何在 supervisord 的同一个文件中发出杀死 gunicorn 和运行 gunicorn 的命令?
- pandas - 熊猫条形图中的刻度标签重叠
- c# - 当用户更改 datagridview 中的值时更改值
- javascript - 检查`App`的渲染方法