我有一个用codeigniter编码的工作网站,PHP突然开始报告错误,例如
<?php
$cats = array('7', '9');
$this->db->select('*');
$this->db->from('posts');
$this->db->where_in('posts.category_id',$cats);
$this->db->where('is_slider=1');
$this->db->where('visibility=1');
$this->db->where('posts.status=1');
$this->db->where('posts.created_at < CURRENT_TIMESTAMP()');
$this->db->order_by('created_at', 'DESC');
$this->db->limit(1);
$query = $this->db->get();
if($query->num_rows()){
$primeras = $query->result();
}
?>
<?php foreach ($primeras as $primera): ?>
<div class="single-default-inner-news">
<div class="news-image">
<?php
if($primera->post_type == "post"){
?>
<a href="#" class="w-100"><img style="min-width:100%" src="<?= base_url() ?><?php echo $primera->image_big ?>" alt="image"></a>
<? } ?>
<?php
if($primera->post_type == "video"){
?>
<a href="#"><img style="min-width:100%" src="<?php echo $primera->image_url ?>" alt="image"></a>
<? } ?>
<a href="<?= base_url() ?><?php echo $primera->title_slug ?>" class="link-overlay"></a>
<div class="news-content" style="padding-top: 15px; width:100%">
<h2><a href="<?= base_url() ?><?php echo $primera->title_slug ?>"><?php echo $primera->title ?></a></h2>
<p><?php echo $primera->summary ?></p>
</div>
</div>
</div>
<?php endforeach; ?>
这就是的错误
消息:语法错误,意外的"endforeach"(T_endforeach(
有什么建议吗?
提前感谢
修复,主机删除了php.ini 中的短标记选项