语法错误转换为NGINX,意外的'elseif'(T
这段代码似乎一直在Apache中工作,但切换到NGINX时,我收到500内部服务器错误。 在我的nginx日志中,我得到了
PHP消息:PHP解析错误:语法错误,意外的'elseif'(T_ELSEIF)在/var/public_html/app/design/frontend//template/seorich/review/summary.phtml第51行“,同时从上游读取响应头,
它引用了这个代码
<?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; ?>
首先需要if
语句才能使用elseif
。 你的意思是只要有if ($this->getDisplayIfEmpty())
? 那之前的代码是什么?
原来的结果是short_open_tags - 任何带有PHP短标签的代码
<?
必须转换为
<?php
因此上面的多行可以防止这种情况发生。 在修改它们之后,我的错误消失了,现在它正在运行。
链接地址: http://www.djcxy.com/p/69843.html上一篇: Syntax error converting to NGINX, unexpected 'elseif' (T