所以我想知道如何放置
<?php
$sql = "SELECT title, script_desc, banner, author, price FROM market";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while ($row = $result->fetch_assoc()) {
echo " <div class=\"item col-xs-4 col-lg-4\">
<div class=\"thumbnail\">
<img class=\"group list-group-image\" src=\"http://placehold.it/400x250/000/fff\" alt=\"\" />" . $row["banner"] . "/> <div class=\"caption\">
<h4 class=\"group inner list-group-item-heading\">" . $row["title"] . "</h4><div class=\"row\">
<div class=\"col-xs-12\">
<div class=\"col-xs-12 col-md-3\">
<p class=\"lead\">"
. $row["price"] . "</div>
<div class=\"col-xs-12 col-md-5\">
0 reviews<br>
<span class=\"glyphicon glyphicon-star\"></span>
<span class=\"glyphicon glyphicon-star\"></span>
<span class=\"glyphicon glyphicon-star\"></span>
<span class=\"glyphicon glyphicon-star\"></span>
<span class=\"glyphicon glyphicon-star\"></span>
</div>
<div class=\"col-xs-12 col-md-4\">
<a class=\"btn btn-success\" href=\"scripts/example1\">" . $row["title"] . "</a> </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
";
$conn->close();
?>
echo " <div class=\"item col-xs-4 col-lg-4\">
<div class=\"thumbnail\">
<img class=\"group list-group-image\" src=\"http://placehold.it/400x250/000/fff\" alt=\"\" />" . $row["banner"] . "/>
因此将"src=\"http://placehold.it/400x250/000/fff\" "
的来源更改为" src=\"$row["banner"] "
因此放置$row["Banner"]
而不是"src=\"http://placehold.it/400x250/000/fff\"
所以基本上把行插入insinde听起来很笨拙的逗号很抱歉,不久前才开始php
答案 0 :(得分:0)
更改此行:
function getArgs (): [string, number] {
return ['hello world', 22]
}
function callFnWithArgs (callback: (...args: ReturnType<typeof getArgs>) => void) {
callback(...getArgs())
}
callFnWithArgs(function (a, b) {
// a is string, b is number
})
到
<img class=\"group list-group-image\" src=\"http://placehold.it/400x250/000/fff\" alt=\"\" />" . $row["banner"] . "/> <div class=\"caption\">
这与将所有其他 <img class=\"group list-group-image\" src=\"" . $row["banner"] . "\" alt=\"\" />" . $row["banner"] . "/> <div class=\"caption\">
变量嵌入到输出中的方式相同。
顺便说一句,如果在字符串周围使用单引号,则不必在其中转义所有双引号。或者,您也可以在其中使用单引号,因为HTML允许在属性周围使用两种引号。