Php 分析错误:语法错误,意外的$end
编辑:我的客户给了我错误的详细信息这里是正确的代码 这是问题所在的部分领域。完整代码太大,但此处可用 这就是让我感到困惑的地方,在我的虚拟机(测试场)上,这段代码是有效的!!证明 但是现在在godaddy主机上它没有 解析错误:语法错误,第297行的/home/content/21/11408921/html/index.php中出现意外的$endPhp 分析错误:语法错误,意外的$end,php,Php,编辑:我的客户给了我错误的详细信息这里是正确的代码 这是问题所在的部分领域。完整代码太大,但此处可用 这就是让我感到困惑的地方,在我的虚拟机(测试场)上,这段代码是有效的!!证明 但是现在在godaddy主机上它没有 解析错误:语法错误,第297行的/home/content/21/11408921/html/index.php中出现意外的$end <?php $ads = array( "<a href='http://3ds-explore.com'><img s
<?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>
成员总数:
新来者:
本网站为©;2012-2013 SocialNeko.
保留所有权利。关于::
db()函数
$db=newmysqli(db\u服务器、db\u用户、db\u通行证、db\u名称);
如果($db->connect\u errno>0){
死亡(看起来我们无法连接到数据库。
一组训练有素的猴子已经被派去处理这种情况。如果你看到它们,向它们显示以下信息:
[“$db->connect_error.”]
在8秒内刷新;
//die('无法连接到数据库');
}
函数db()
{
全球$db;
全球$东道国;
全局$db_用户名;
全球$db_通行证;
全局$db_名称;
如果(!$db){
$db=新的mysqli(db_服务器、db_用户、db_通行证、db_名称);
}
返回$db;
}
这只是一个标准的“肘部润滑脂”调试问题:根据我的经验,行号通常与此错误无关,因为它给出了EOF ln#,并且根据其中一条注释,它通常是一个未闭合的括号、括号等
我发现的一种老练但富有成效的方法是在出口处下车代码>从脚本中的第一个代码块开始,如果执行到该点时没有出现错误,则删除exit代码>从那一点开始,再往下放。最终,您应该与逐行调试进行比较
i、 e:
会员和成长!
我相信Go Daddy在默认情况下关闭了php短标记-short\u open\u tag=off
那么第78行呢
<? }else{ ?>
八十
92
286
290
没有解析
最好的办法是将它们全部更改为页面顶部的
,但不推荐使用。请参阅侧栏,它有许多类似的问题。我明白了,嗯。非常令人沮丧。footer.php中有什么内容?@Jordan为什么不将所有文件加载到一个漂亮的IDE或文本编辑器中,并使用语法高亮显示,然后找到不匹配的括号?或者确保文件被完全上传到服务器,有时当我只使用FTP上传文件的一部分时,我会出现错误。这就是我得到的。这是否意味着我的问题在上面?解析错误:语法错误,意外的T_退出,在第279+1行的/home/content/21/11408921/html/index.php中应为“')。是的,问题是短标记,@Abu replace最糟糕的是我被否决了L
<?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>"
);
// Start Cutoff: 1st try to make sure code is executing up to this point:
exit;
// End Cut Off -- if it executed up to here - move this cutoff block further down,
// until you can approximate where the error is occuring
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>
<? }else{ ?>
<? } ?>
<? } ?>
<? }else{ ?>
<? } ?>