我想在网页上显示YouTube视频,以下是我的代码,用于从存储在MySQL中的数据库中获取YouTube视频URL,然后使用while循环进行迭代以显示它。 但是,iframe内没有显示任何视频。
<?php
if ($get_result != false) {
while ($row = mysqli_fetch_array($get_result, MYSQLI_ASSOC)) {
?>
<iframe width="560" height="315" src="<?php echo $row["url"]; ?>" frameborder="0" allowfullscreen></iframe>
<?php
}
}
?>
我也尝试在while循环内使用video标签,但它无法在视频播放器中显示YouTube视频。 请帮助我解决这个问题。
<iframe width="560" height="315" src="https://www.youtube.com/watch?v=txSGdNONUJE" frameborder="0" allowfullscreen></iframe>
。 - suhas gawde$new_url = str_replace("https://www.youtube.com/watch?v=","https://www.youtube.com//v/",$url);
。 - suhas gawde