我知道如何连接php变量,但是如果html内的其他脚本是php呢?我用下面的代码:
$output .='
<div class="col-md-3 mb-4">
<div class="card h-100">
<img class="card-img-top" src="../admin/upload/'. $row['images'].'" width="50px" height="300px" alt="Image">
<div class="overlay">
<p><strong> Title : </strong>'. $row['title'].'</p>
<p><strong> Author : </strong>'. $row['author'].'</p>
<p><strong> ISBN : </strong>'. $row['isbn'].'</p>
</div>
<div class="card-body">
'.$status='';
if ($row ['status'] == 'Available')
{
$status='success';
}
else if ($row ['status'] == 'Unavailable')
{
$status ='danger';
}.'
<a href="book_details.php?title='. $row['title'].'&isbn='. $row['isbn'].'"> <button type="button"class="btn btn-'.$status.'">'. $row['status'].'</button></a>
</div>
</div>
</div>';
我如何连接我的字符串,尤其是在php if else语句时?感谢您的帮助
您不能那样做。最干净的解决方案是将if
语句before