获取图库时出错

时间:2014-09-16 02:17:33

标签: php sql

我对此代码有疑问。画廊功能给我错误。我是php新手,所以我发现这个画廊广告真的想在我的网站上实现它。

评论错误:Parse error: parse error in C:\wamp\www\trauma\gallery.php on line 5.

这是我的代码:

   <?php
 require_once("connections/connection.php"); 
include_once('header.php');

 public function gallery()
{
$qry = $this->select("photocategories WHERE pho_published=1");
 $count = 1;
 while($arr = $this->fetch($qry))
 {
  $qry1 = $this->select("photos WHERE pht_pho_ID=$arr[pho_ID]");
  $arr1 = $this->fetch($qry1);
 ?>
 <div class="col-sm-6 col-md-3">
  <a href="photos.php?pho_ID=<?php echo $arr['pho_ID']; ?>">
     <div class="thumbnail">
    <img src="uploads/photos/thumbs/<?php echo $arr1['pht_image']; ?>" alt="<?php echo                           
      arr['pho_title']; ?>" class="img-responsive">
      <div class="caption">
     <h1 style="line-height:10px; text-align:center;"><?php echo $arr['pho_title']; ?></h1>
    </div>
   </div>
  </a>
 </div>
<?php
 if($count % 4 == 0) { echo '</div><div class="row">'; }
 $count++;
 }
}

1 个答案:

答案 0 :(得分:0)

删除函数前面的public,使其如下所示:

function gallery() { ... }

public关键字仅适用于declaring the visibility方法和属性。