我正在移动我的网站,一切都运行良好,除了在一个页面上我收到以下错误:
解析错误:语法错误,意外的$ end,期望第85行的domain / details.php中的T_VARIABLE或T_DOLLAR_OPEN_CURLY_BRACES或T_CURLY_OPEN
它正在给我修复的其他错误,但这个我不能。
以下是details.php页面的第80-85行。那是文件的结尾。 任何帮助都会很棒
if(!class_exists('Snippets')) {
require_once dirname(__FILE__).'/snippets.class.php';
if(!class_exists('Snippets')) {
require_once dirname(__FILE__).'/snippets.class.php';
}
?>
===================
添加新内容:
感谢。我对所有上述方法都很感兴趣,但仍然会出错。现在它说第84行(这是最后一行)。这就是我改为:
if(!class_exists('Snippets')) {
require_once dirname(__FILE__).'/snippets.class.php';
}
?>
======片段=====
<?php
class Snippets {
function google_analytics() {
if(ANALYTICS === true) {?>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("<?php echo ANALYTICS_ID; ?>");
pageTracker._trackPageview();
} catch(err) {}
</script>
<?php }
}
function desktop() {
if(DESKTOP === true) {?>
<p class="bottomlinks"><span>Mobile</span> | <span><a href="<?php echo DESKTOP_LINK; ?>">Desktop</a></span></p>
<?php }
}
function icon_call() {
if(CALL === true) {?>
<a href="tel:<?php echo CALL_LINK; ?>" rel="nofollow"><img src="images/icon_phone.gif" width="38" height="38" alt="Click to Call" /></a>
<?php }
}
function icon_facebook() {
if(FACEBOOK === true) {?>
<a href="<?php echo FACEBOOK_LINK; ?>" rel="nofollow"><img src="images/icon_facebook.gif" width="38" height="38" alt="Facebook" /></a>
<?php }
}
function icon_map() {
if(MAP === true) {?>
<a href="<?php echo MAP_LINK; ?>" rel="nofollow"><img src="images/icon_map.gif" width="38" height="38" alt="View a Map" /></a>
<?php }
}
function icon_linkedin() {
if(LINKEDIN === true) {?>
<a href="<?php echo LINKEDIN_LINK; ?>" rel="nofollow"><img src="images/icon_linkedin.gif" width="38" height="38" alt="Linked In" /></a>
<?php }
}
function icon_twitter() {
if(TWITTER === true) {?>
<a href="<?php echo TWITTER_LINK; ?>" rel="nofollow"><img src="images/icon_twitter.gif" width="38" height="38" alt="Twitter" /></a>
<?php }
}
function slogan() {
if(SLOGAN === true) {?>
<p><?php echo SLOGAN_TEXT_LINE1; ?><br /><?php echo SLOGAN_TEXT_LINE2; ?></p>
<?php }
}
function click_to_call() {
if(CLICKTOCALL === true) {?>
<!-- Start Call Button -->
<div class="buttonclick"><a href="<?php echo BUTTON_LINK; ?>"><?php echo BUTTON_TEXT; ?></a></div>
<!-- End Call Button -->
<?php
}
}
}
$snippets = new Snippets;
?>
答案 0 :(得分:2)
示例代码中有两个开放{
和只有一个结束}
大括号。
答案 1 :(得分:1)
你忘了关闭第二个大括号.. :)编辑这样的内容
require_once dirname(__FILE__).'/snippets.class.php';
if(!class_exists('Snippets')) // Removed the curly brace :)
require_once dirname(__FILE__).'/snippets.class.php';
答案 2 :(得分:0)
if(!class_exists('Snippets')) {
require_once dirname(__FILE__).'/snippets.class.php';
if(!class_exists('Snippets')) {
require_once dirname(__FILE__).'/snippets.class.php';
}
}//<------------ Here
?>