我得到了分析錯誤:語法錯誤,262行(代碼的最後一行)出現意外的文件結尾。我使用了一些PHP代碼跳棋,但我無法找到問題的話... Here is the codePHP/HTML意外的文件結尾
<?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 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$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
}?>
迷你聊天.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; ?>
如果您不發佈代碼,您如何期待我們提供幫助?到任意網站的鏈接不是替代品。這在「如何以及要問什麼」一節中有明確的解釋。相反,請儘可能減少代碼,以使效果依然存在。無論如何,當你試圖找出問題的原因時,你就必須這樣做。 – arkascha
@arkascha我這樣做是因爲如果我發佈了所有的代碼,它說我的帖子大部分是代碼。由於我不知道有什麼問題,我不知道如何減少代碼...... – DaNy3LL
很明顯,您可以簡單地刪除幾個php位之間的所有html代碼,因爲標記顯然不會導致語法錯誤。 – arkascha