我正在尝试使用存储在数据库中的代码显示youtube嵌入式视频。但它显示出错误。我做错了什么..?
<?php
require 'db.php';
$result = $mysqli->query("SELECT * FROM ycodes") or die($mysqli->error());
$row = mysqli_fetch_array($result);
echo $row['ycode'];
?>
<!DOCTYPE html>
<html>
<body>
<iframe width="560" height="315" src="https://www.youtube.com/embed/<?$row['ycode']?>" frameborder="0" allowfullscreen></iframe>
</body>
</html
答案 0 :(得分:0)
<iframe width="560" height="315" src="https://www.youtube.com/embed/<?$row['ycode']?>" frameborder="0" allowfullscreen></iframe>
更改为
<iframe width="560" height="315" src="https://www.youtube.com/embed/<?php echo $row['ycode'];?>" frameborder="0" allowfullscreen></iframe>