我正在嘗試在此程式碼中使用 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
為什麼會出現這個錯誤?
.................................................. .... …………
您可以轉義字串並將變數連接到您希望的位置,如下所示: