gpt4 book ai didi

php - 如何从数据库读取Youtube url?

转载 作者:行者123 更新时间:2023-11-29 17:47:13 26 4
gpt4 key购买 nike

我正在读取我的数据库,其中包含各种列以及名为 video_games_trailer 的 varchar(500) 列,其中包含 YouTube 视频的 url。到目前为止,一切都显示良好,但在视频应有的位置上,我得到以下内容:

Not Found 
The requested URL /Project/<embed width= was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an
ErrorDocument to handle the request.

我正在使用下面的代码显示列

 <?php while($row = mysqli_fetch_array($result)){?>

<tr>
<td><iframe width="560" height="315" frameborder="0"
allowfullscreen src="<?php echo
$row['video_games_trailer'];?>"></iframe></td>
</tr>
<?php } ?>

在我放入的数据库中

<embed width="560" height="315" src="https://www.youtube.com/embed/whatever">

无论我在哪里看到建议的方法,我是否遗漏了什么以及我可以做什么来解决这个问题?

最佳答案

看起来好像您正在存储

<embed width="560" height="315" src="https://www.youtube.com/embed/whatever">

事实上你应该回显以下内容

 <?php while($row = mysqli_fetch_array($result)){?>

<tr>
<td><?php echo
$row['video_games_trailer'];?>"></td>
</tr>
<?php } ?>

但是,您最好只存储 URL 的 watch ID 部分或仅存储 URL。

关于php - 如何从数据库读取Youtube url?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49708037/

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