我收到Parse错误:语法错误,第262行的文件意外结束(代码的最后一行)。我使用了一些PHP代码检查器,但我找不到错误的东西...... Here is the code
<?php include('head.php'); ?>
<? ini_set('display_errors', "On"); error_reporting(E_ALL); include('header.php'); ?>
<?php include('menu.php'); ?>
<?php if(!isset($_SESSION['steamid'])) { ?>
<?php } else { ?>
<?php echo $detailsWrapClass; ?>
<?php echo $steamprofile['personaname'];?>
<?php echo "<img src=\"".$steamprofile['avatarfull']."\" class=\"avatar\" width=\"60px\">";?>
<? } ?>
<? include ('mini-chat.php'); ?>
<? include ('game.php'); ?>
head.php
<? require('steamauth/steamauth.php'); ?>
<?
if(isset($_SESSION["steamid"])) {
include_once('steamauth/userInfo.php');}
?>
<?
if ($steamprofile['steamid'] == 1 || $steamprofile['steamid'] == 2 || $steamprofile['steamid'] == 3) {
exit('<script language="JavaScript">window.location.href = "/banned"</script>');
}
?>
的header.php
<?php
if(!isset($_SESSION['steamid'])) {
} else {
include ('steamauth/userInfo.php');
?>
<?php echo $steamprofile['steamid'];?></div>
<?php
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
$rstr = generateRandomString(32);
$m = new MongoClient("mongodb://ip:28724");
$db = $m->admin;
$collection = $db->authdb;
$document12 = array( "userid" => $_SESSION['steamid'] );
$collection->remove($document12);
$document = array( "userid" => $_SESSION['steamid'], "token" => $rstr );
$collection->save($document);
echo $rstr;
?>
<?php
}?>
迷你chat.php
<?php if(isset($_SESSION['steamid'])) {
echo '<div id="nav-two-b" class="content-container-row1-chat-input">
<input type="text" name="" id="text-massage" />
<button class="-btn -btn-primary" id="send_massage"><span class="-sp -sp-enter"></span></button>
</div>';
}
else {
echo '';
}
?>
game.php
<?php if(!isset($_SESSION['steamid'])) {$detailsWrapClass = 'hidden'; $enterClass = ''; $text_game = 'Вступай в игру сейчас и выиграй: '; ?>
<?php } else {$text_game = 'БАНК: '; $detailsWrapClass = ''; $enterClass = 'hidden'; ?>
<?php } ?>
<?php echo $text_game; ?><span id="jackpot-temp">
<?php if(!isset($_SESSION['steamid'])) {?>
<?php } else {?>
<? } ?>
<?php echo $detailsWrapClass; ?>
答案 0 :(得分:0)
您在第46行打开了一个else
个案例,但在到达文件末尾之前不要关闭它。所以PHP说文件意外结束 - 因为有一个开放条件。