解析错误:语法错误,第297行/home/content/21/11408921/html/index.php中的意外$结尾
<?php
$ads = array(
"<a href='http://3ds-explore.com'><img src='http://puu.sh/391aC.png'></a>",
"<a href='http://socialpixel.heliohost.org'><img src='/image/socialpixel.png'></a>",
"<a href='http://strike.koding.com'>DSiStrike</a>",
"<a href='http://3dsar7.koding.com'><img src='/image/remixed.png'></a>",
"<a href='http://l09.heliohost.org'><img src='/image/l09.png'></a>"
);
print_r($ads[array_rand($ads)]);
?></center>
<span style="position:absolute;top:60px;left:180px;font-size:10px;color:gray;letter-spacing:-1px;-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;">
<?php echo $database->getNumMembers(); ?> members and growing!
</span>
<br><center><a href="http://mobile.twitter.com/sosharuneko"><img src="/image/follow.png"></a></center><br>
<?php include("footer.php"); ?>
</body>
</html>
footer.php:
<hr>
<div class="footer" style="font-size:10px;color:grey"> <center>
Total members: <?php echo $database->getNumMembers(); ?><br>
Newcomer: <?php
$getnewcomer = mysqli_query(db(), "SELECT username FROM users ORDER BY id DESC");
$newcomer = mysqli_fetch_row($getnewcomer);
if($session->logged_in){
echo "<a href='/user/".strtolower($newcomer[0])."'>$newcomer[0]</a>";
} else {
echo $newcomer[0];
}
?>
<p> <div class="copyright"> This website is ©2012-2013 SocialNeko.<br> All rights reserved.<p> About :: <a href="/guide/terms.php">Terms</a></center> </div><p>
</div>
db()函数
$db = new mysqli(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
if($db->connect_errno > 0){
die("<p><b>It looks like we can't connect to the database.</b><br>A team of highly trained monkeys has been dispatched to deal with this situation.<p>If you see them, show them this information:<br>[" . $db->connect_error . "]<br>Refreshing in 8 seconds. <meta http-equiv='REFRESH' content='8;url='>");
//die('Unable to connect to database ');
}
function db()
{
global $db;
global $host;
global $db_username;
global $db_pass;
global $db_name;
if (!$db) {
$db = new mysqli(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
}
return $db;
}
答案 0 :(得分:1)
这只是一种标准的肘部油脂&#39;调试问题:根据我的经验,这个错误的行号通常没用,因为它给出了EOF ln#和每条评论,它通常是一个未公开的括号,paren等。
我找到的一种hacky,但很有效率的方法是从脚本中的第一个代码块开始放入exit;
,如果它执行到那个时没有出错,请删除{从那时起{1}},并进一步说明。最终你应该逐行调试你的错误。
即:
exit;
答案 1 :(得分:1)
我相信Go Daddy默认关闭php短标记 - short_open_tag = off
。
第78行
<? }else{ ?>
80
<? } ?>
92
<? } ?>
286
<? }else{ ?>
290
<? } ?>
没有解析。
最好的办法是将它们全部更改为<?php
。
您也可以更改php.ini中的short_open_tag = on
或页面顶部的<?php ini_set(‘short_open_tag’,’1′); ?>
,但不建议这样做。