这段代码似乎一直在Apache中运行,但是当切换到NGINX时,我收到500内部服务器错误。在我的nginx日志中,我得到了
PHP消息:PHP解析错误:语法错误,意外' elseif' (T_ELSEIF)在第51行和第34行的/var/public_html/app/design/frontend//template/seorich/review/summary.phtml中;从上游读取响应头时,
它引用了这段代码
<?php elseif ($this->getDisplayIfEmpty()): ?>
<p class="no-rating"><a href="<?php echo $this->getReviewsUrl() ?>#review-form"><?php echo $this- >__('Be the first to review this product') ?></a></p>
<?php endif; ?>
这是“整个成功页面”
<?php
/**
* @author Robogento <support@robogento.com>
* @package Robogento
* @subpackage SEO Rich
* @url http://robogento.com
*
* This code is protected by copyright and you are not allowed to share it, alter it and sell as your own.
* @copyright Copyright (c) 2012 Robogento
*/
?>
<?php if ($this->getReviewsCount()): ?>
<div class="ratings">
<?php if ($this->getRatingSummary()):?>
<div class="rating-box">
<div class="rating" style="width:<?php echo $this->getRatingSummary() ?>%"></div>
</div>
<?php endif;?>
<p class="rating-links">
<!--review property for google rich snippets start-->
<?php if($this->helper('seorich')->isEnabledAttr("review")):?><!--Check if rich snippet enabled for image-->
<span itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
(<span itemprop="ratingValue"><?php echo sprintf ("%.1f",($this->getRatingSummary()/100)*5);?></span> out of <span itemprop="bestRating">5</span>)
<a href="<?php echo $this->getReviewsUrl() ?>">
<span itemprop="reviewCount"><?=$this->getReviewsCount()?></span>
<?php echo $this->__('Review(s)') ?>
</a>
</span>
<?php else: ?>
<a href="<?php echo $this->getReviewsUrl() ?>">
<?=$this->getReviewsCount()?>
<?php echo $this->__('Review(s)') ?>
</a>
<?php endif; ?>
<!--review property for google rich snippets end-->
<span class="separator">|</span>
<a href="<?php echo $this->getReviewsUrl() ?>#review-form"><?php echo $this->__('Add Your Review') ?></a>
</p>
</div>
<?php elseif ($this->getDisplayIfEmpty()): ?>
<p class="no-rating"><a href="<?php echo $this->getReviewsUrl() ?>#review-form"><?php echo $this->__('Be the first to review this product') ?></a></p>
<?php endif; ?>
答案 0 :(得分:1)
首先需要if
语句才能使用elseif
。你的意思是if ($this->getDisplayIfEmpty())
吗?之前的代码是什么?
答案 1 :(得分:1)
结果发现问题出现在short_open_tags中 - 任何带有短标签的代码
<?
必须转换为
<?php
因此上面的多行阻止了这种情况的发生。在修改它们之后,我的错误消失了,它现在正在运行。