gpt4 book ai didi

javascript - 从 iframe 视频获取 youtube 视频 ID

转载 作者:搜寻专家 更新时间:2023-10-31 20:35:10 25 4
gpt4 key购买 nike

<?php echo $videoFirstArray['fileToUpload']; ?>

这个字段包含ifrmae,类似这样

<iframe width="560" height="315" src="https://www.youtube.com/embed/ISMzgunUono" frameborder="0" allowfullscreen></iframe>

由此我想要这个“ISMzgunUono”。我搜索了论坛并点击了链接,但没有找到任何方法将我的“fileToUpload”字段保留在预匹配中。我关注的一些链接: Get YouTube video id from embed iframe code这个链接给出了一个错误 how to get Video id from iframe of youtube in php or cakephp期待尽快回复:

最佳答案

严格来说,在 PHP 中,您应该能够运行:

preg_match('/youtube.com\/embed\/([A-Za-z0-9-]+)/', $videoFirstArray['fileToUpload#'], $matches);
if($matches[1]) {
echo $matches[1];
}

它应该回显 ISMzgunUono。不过,这是未经测试的!让我知道它是否有效。

关于javascript - 从 iframe 视频获取 youtube 视频 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37522275/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com