我正在尝试在此代码中使用 echo
<?php require 'connect.php'; $query = mysqli_query($conn, "SELECT * FROM `videos`") or die(mysqli_error()); while($fetch = mysqli_fetch_array($query)){ $id= $fetch['id']; ?> <?php echo " <li class='col-lg-4 col-md-6 col-dm-12'> <div class='da-card box-shadow'> <div class='da-card-photo'> <img src=' echo $fetch['video_name']' alt=''> <div class='da-overlay'> <div class='da-social'> <h4 class='mb-10 color-white pd-20'></h4> <ul class='clearfix'> <li> <a href='' data-fancybox='images'><i class='fa fa-picture-o'></i></a> </li> <li> <a href='#'><i class='fa fa-link'></i></a> </li> </ul> </div> </div> </div> </div> </li> "; ?> <?php } ?>
我收到此错误 Parse 错误:语法错误,意外的字符串内容“”,期望“-”或标识符或变量或数字位于 C:\xampp\htdocs\desk\gallery.php 行 572
为什么会出现这个错误?
...................................................... …………
您可以转义字符串并将变量连接到您希望的位置,如下所示: