为什么 blockquote 标签在 PHP 循环中不起作用?
Why blockquote tag does not work in PHP loop?
我正在 return 从我的数据库中获取数据,所有数据都有效,除了图像,由于某种原因 blockquote 标签只打印在第一行,我正在使用 embed.js
来return Imgur 照片和 .gifs
html
<script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
php
<h1>Fotos e gifs</h1>
<?php
include_once("config.php");
$result = mysqli_query($mysqli, "SELECT * FROM posts ORDER BY codigo DESC");
while($res = mysqli_fetch_array($result)) {
echo "<h3>".$res['titulo']."</h3>";
echo "<blockquote class='imgur-embed-pub' lang='en' data-id='".$res['link_imagem']."'></blockquote>";
echo "<hr>";
}
?>
这是正在发生的事情和我的数据库。
我找到了一个解决方案,出于某种原因每个脚本都支持一个块引用,我只是像这样在 while 循环中添加到脚本标签中:
while($res = mysqli_fetch_array($result)) {
echo "<h3>".$res['titulo']."</h3>";
echo "<blockquote class='imgur-embed-pub' data-id='".$res['link_imagem']."'></blockquote>"."<script async src='//s.imgur.com/min/embed.js' charset='utf-8'></script>";
echo "<p>".$res['conteudo']."</p>";
echo "<hr>";
}
我正在 return 从我的数据库中获取数据,所有数据都有效,除了图像,由于某种原因 blockquote 标签只打印在第一行,我正在使用 embed.js
来return Imgur 照片和 .gifs
html
<script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
php
<h1>Fotos e gifs</h1>
<?php
include_once("config.php");
$result = mysqli_query($mysqli, "SELECT * FROM posts ORDER BY codigo DESC");
while($res = mysqli_fetch_array($result)) {
echo "<h3>".$res['titulo']."</h3>";
echo "<blockquote class='imgur-embed-pub' lang='en' data-id='".$res['link_imagem']."'></blockquote>";
echo "<hr>";
}
?>
这是正在发生的事情和我的数据库。
我找到了一个解决方案,出于某种原因每个脚本都支持一个块引用,我只是像这样在 while 循环中添加到脚本标签中:
while($res = mysqli_fetch_array($result)) {
echo "<h3>".$res['titulo']."</h3>";
echo "<blockquote class='imgur-embed-pub' data-id='".$res['link_imagem']."'></blockquote>"."<script async src='//s.imgur.com/min/embed.js' charset='utf-8'></script>";
echo "<p>".$res['conteudo']."</p>";
echo "<hr>";
}