我有一個iframe在我的website.I要創建的視頻我有一個縮略圖url的iframe存儲在database.I要創建這個我試過代碼視頻的縮略圖。<img src="http://img.youtube.com/vi/_uQrJ0TkZlc/hqdefault.jpg" alt="" style="height:61px">它運行良好,但問題是我使用的(_uQrJ0TkZlc)id 是靜態的。我希望該 id 應該是動態的,它存在于我的數據庫表中這是我的 iframe<iframe style="width:10px;height:10px;" id="<?php echo $fetchorderdetails['id']?>" src="<?php echo $fetchorderdetails['video_links']?>rel=0&wmode=Opaque&enablejsapi=1;showinfo=0;" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
2 回答
蝴蝶不菲
TA貢獻1810條經驗 獲得超4個贊
而不是存儲整個鏈接到嵌入視頻,只存儲 ID。這樣,您既可以訪問嵌入的視頻,也可以訪問縮略圖鏈接。要將變量插入到字符串中,請使用"<img src="http://img.youtube.com/vi/" . $id . "/hqdefault.jpg" alt="" style="height:61px">". 見https://www.php.net/manual/en/language.operators.string.php
嗶嗶one
TA貢獻1854條經驗 獲得超8個贊
您應該使用視頻網址的“嵌入”版本,其中包含嵌入字詞
<iframe width="200" height="150" src="https://www.youtube.com/embed/iqlp5g8-W3I" frameborder="0" allowfullscreen></iframe>
非嵌入式網址在 iframe 中不起作用
- 2 回答
- 0 關注
- 174 瀏覽
添加回答
舉報
0/150
提交
取消
