我有一个PHP网站,索引页面显示在线,但我在我的wamp服务器上运行的本地副本给了我一个解析器错误"解析错误:语法错误,文件意外结束...&# 34;
我的本地PHP与我的作品相同。 5.6
我查看了之前提出的问题PHP parse/syntax errors; and how to solve them?,它没有提到文件结尾。
这是我的代码:
<?php
include "Calls.php";
my_session_start();
$sessionid = @$_SESSION["id"];
ini_set ("display_errors", "1");
error_reporting(E_ALL);
ini_set('short_open_tag',true);
include "production.class.php";
include "emailFunctions.php";
$selection="";
$mat = "";
include "currentSeason.php";
//current production
$currProd = new Production($arrSeason[0]['logo'],$arrSeason[0]['odate'],$arrSeason[0]['cldate'],$arrSeason[0]['credits'],$arrSeason[0]['director'],$arrSeason[0]['synopsis'],$arrSeason[0]['characters'],$arrSeason[0]['cast'],$arrSeason[0]['actors'],$arrSeason[0]['photos'],$arrSeason[0]['crewPositions'],$arrSeason[0]['crewNames'],$arrSeason[0]['season'],$arrSeason[0]['shownum'],$arrSeason[0]['showname'],$arrEntireSeason[0]['auddate'],$arrEntireSeason[0]['Special'],$arrEntireSeason[0]['Rights'],$arrSeason[0]['rightsText'],$arrEntireSeason[0]['matinee'],$arrEntireSeason[0]['ticketform'],$arrEntireSeason[0]['Promotion'],$arrEntireSeason[0]['misc'],$arrEntireSeason[0]['Type']);
$curshow=$currProd->getshownumber();
$arrSize = $aS+$aaud+$aevents+$aalerts;
$Events = array();
for($x=0;$x<sizeof($arrSeason);$x++){
$Events[$x][0] = "show";
$Events[$x][1] = $arrSeason[$x]["showname"];
$Events[$x][2] = $arrSeason[$x]["odate"];
$Events[$x][3] = $arrSeason[$x]["cldate"];
$Events[$x][4] = $arrSeason[$x]["director"];
$Events[$x][5] = $arrSeason[$x]["credits"];
$Events[$x][6] = $arrSeason[$x]["season"];
$Events[$x][7] = "";
$Events[$x][8] = "";
$Events[$x][9] = "";
$Events[$x][10] = $arrSeason[$x]["shownum"];
$Events[$x][11] = $arrSeason[$x]["cast"];
$Events[$x][12] = $arrSeason[$x]["Promotion"];
}
if($aaud>1){
for($a1=0;$a1<sizeof($arrAudInfo);$a1++){
$Events[$x][0] = "audition";
$Events[$x][1] = $arrAudInfo[$a1]["showname"];
$Events[$x][2] = $arrAudInfo[$a1]["auddate"];
$Events[$x][3] = "";
$Events[$x][4] = "";
$Events[$x][5] = "";
$Events[$x][6] = $arrAudInfo[$a1]["season"];
$Events[$x][7] = $arrAudInfo[$a1]["when"];
$Events[$x][8] = $arrAudInfo[$a1]["where"];
$Events[$x][9] = $arrAudInfo[$a1]["matOnline"];
$Events[$x][10] = $arrAudInfo[$a1]["shownum"];
$Events[$x][11] = "";
$Events[$x][12] = $arrAudInfo[$a1]["audID"];
$x+=1;
}
}
if($aaud==1){
$Events[$x][0] = "audition";
$Events[$x][1] = $arrAudInfo[0]["showname"];
$Events[$x][2] = $arrAudInfo[0]["auddate"];
$Events[$x][3] = "";
$Events[$x][4] = "";
$Events[$x][5] = "";
$Events[$x][6] = $arrAudInfo[0]["season"];
$Events[$x][7] = $arrAudInfo[0]["when"];
$Events[$x][8] = $arrAudInfo[0]["where"];
$Events[$x][9] = "";
$Events[$x][10] = $arrAudInfo[0]["shownum"];
$Events[$x][11] = "";
$Events[$x][12] = $arrAudInfo[0]["audID"];
$x+=1;
}
if($aevents>1){
for($a2=0;$a2<sizeof($arrEvents);$a2++){
$Events[$x][0] = "event";
$Events[$x][1] = $arrEvents[$a2]["Event"];
$Events[$x][2] = $arrEvents[$a2]["eventDate"];
$Events[$x][3] = "";
$Events[$x][4] = "";
$Events[$x][5] = "";
$Events[$x][6] = "";
$Events[$x][7] = "";
$Events[$x][8] = $arrEvents[$a2]["where"];
$Events[$x][9] = "";
$Events[$x][10] = $arrEvents[$a2]["ID"];
$Events[$x][11] = $arrEvents[$a2]["EventDetails"];
$x+=1;
}
}
if($aevents == 1){
$Events[$x][0] = "event";
$Events[$x][1] = $arrEvents[0]["Event"];
$Events[$x][2] = $arrEvents[0]["eventDate"];
$Events[$x][3] = "";
$Events[$x][4] = "";
$Events[$x][5] = "";
$Events[$x][6] = "";
$Events[$x][7] = "";
$Events[$x][8] = $arrEvents[0]["where"];
$Events[$x][9] = "";
$Events[$x][10] = $arrEvents[0]["ID"];
$Events[$x][11] = $arrEvents[0]["EventDetails"];
}
if($aalerts == 1){
$Events[$x][0] = "alert";
$Events[$x][1] = $arrAlerts[0]["Alert"];
$Events[$x][2] = $arrAlerts[0]["alertDate"];
$Events[$x][3] = "";
$Events[$x][4] = "";
$Events[$x][5] = "";
$Events[$x][6] = "";
$Events[$x][7] = "";
$Events[$x][8] = $arrAlerts[0]["where"];
$Events[$x][9] = "";
$Events[$x][10] = $arrAlerts[0]["ID"];
$Events[$x][11] = $arrAlerts[0]["AlertDetails"];
}
//Sort events by date
array_sort_by_column($Events,2);
//register email
if(isset($_POST['emailSub'])){
joinEmail($_POST['email']);
}
function array_sort_by_column(&$array, $column, $direction = SORT_ASC){
$reference_array = array();
foreach($array as $key => $row){
$reference_array[$key] = $row[$column];
}
array_multisort($reference_array, $direction, $array);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>The Little Theatre of Jefferson City</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/menu.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="images/favicon.ico" />
<script src="scripts/plugins.js"></script>
<script>
function getCast(num,season){
document.getElementById("showDetails").src = "cast.php?season=" + season + "&shownum=" + num;
}
function getAudInfo(num,season,aid){
//alert(aid);
document.getElementById("showDetails").src = "viewAudInfo.php?aid=" + aid + "&season=" + season + "&shownum=" + num;
}
function getEvent(num){
//alert(num)
document.getElementById("showDetails").src = "eventdetail.php?event=" + num;
}
function getAlert(num){
//alert(num)
document.getElementById("showDetails").src = "alertdetail.php?alert=" + num;
}
function getVideo(file,auto){
document.getElementById('player2').src="video.php?video="+file+"&auto="+auto;
}
</script>
<style type="text/css">
#dhtmltooltip{
font-size: 12px;
position: absolute;
width: 200px;
border: 3px inset black;
padding: 2px;
background-color: lightyellow;
visibility: hidden;
z-index: 100;
/*Remove below line to remove shadow. Below line should always appear last within this CSS*/
filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135);
}
</style>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-39749769-1', 'tltjc.org');
ga('send', 'pageview');
</script>
</head>
<body>
<div id="dhtmltooltip"></div>
<script type="text/javascript">
/***********************************************
* Cool DHTML tooltip script- � Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
selectArray=new Array("Click on the Prison Brews logo to download a special promotion for Whorehouse ticket holders!")
var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=selectArray[thetext]
enabletip=true
return false
}
}
function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"
//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}
function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
document.onmousemove=positiontip
</script>
<div id="main">
<div class="container">
<div id="header">
<div id="logo">
</div>
</div>
<?php include "menu.php" ?>
<div id="block_collage" class="block_flash">
<script type="text/javascript">
if (pluginlist.indexOf("Flash")!=-1){
document.write ("<embed src='images\/collage.swf' wmode='transparent' quality='high' pluginspage='http:\/\/www.macromedia.com\/go\/getflashplayer' type='application\/x-shockwave-flash' width='938' height='264'><\/embed>");
}
</script>
</div>
<div id='SpecialAnnouncement' class="block">
<h2>Now Available</h2>
<h3>Purchase your memberships online</h3><br />
You can now purchase 2016-2017 Season Memberships at all levels right here on our website! <a href="https://www.tltjc.org/memberships/products.php">Follow this link</a> to purchase your membership using your Visa, Mastercard or Discover.
</div>
<div id="leftpane">
<div id="block_featured" class="block">
<h2>Upcoming TLT Events</h2>
<?
for($zzz=0;$zzz<sizeof($Events);$zzz++){
?>
<div class="event">
<? if($Events[$zzz][0]=="show"){?>
<h4>
<a href="seasons.php?shownum=<?=$Events[$zzz][10]?>&curs=<?= $Events[$zzz][6]?>">
<?=switchThe($Events[$zzz][1])?>
</a>
</h4>
<div class="showinfo">
<? if(strpos($Events[$zzz][5],"by")==0){ echo "by"; }?> <?=switchThe($Events[$zzz][5])?><br/>
directed by <?=$Events[$zzz][4]?><? if(strpos($Events[$zzz][1],"Whorehouse")>0){?> <a href='TLT_PB_Promo.pdf' onMouseover="ddrivetip(0,'#efe1ac', 500)" onMouseout="hideddrivetip()" target="_blank"><img src="images/prisonbrews_logo.jpg" style="float:right" /></a><? } ?><br/>
<? if(date("d",strtotime($Events[$zzz][2]))==01){?>
Show dates: <?=date("M",strtotime($Events[$zzz][2])).", ".date("Y",strtotime($Events[$zzz][3]))?><br/>
<? } else{?>
Show dates: <?=date("M",strtotime($Events[$zzz][2]))." ".date("d",strtotime($Events[$zzz][2]))."-".date("d",strtotime($Events[$zzz][3])).", ".date("Y",strtotime($Events[$zzz][3]))?><br/>
<? } ?>
</div>
<? } ?>
<? if($Events[$zzz][0]=="audition"){?>
<h4><a href="#ci" onClick="getAudInfo(<?=$Events[$zzz][10]?>,'<?=$Events[$zzz][6]?>',<?=$Events[$zzz][12]?>)"><? echo "Auditions-".switchThe($Events[$zzz][1])?></a></h4>
<div class="showinfo">
When: <?=date("M",strtotime($Events[$zzz][2]))." ".date("d",strtotime($Events[$zzz][2])).", ".date("Y",strtotime($Events[$zzz][2]))." at ".$Events[$zzz][7]?><br/>
Where: <?=$Events[$zzz][8]?>
</div>
<? } ?>
<? if($Events[$zzz][0]=="event"){?>
<h4><a href="#ci" onclick="getEvent(<?=$Events[$zzz][10]?>)"><?=switchThe($Events[$zzz][1])?></a></h4>
<div class="showinfo">
When: <?=date("M",strtotime($Events[$zzz][2]))." ".date("d",strtotime($Events[$zzz][2])).", ".date("Y",strtotime($Events[$zzz][2]))?><br/>
Where: <?=$Events[$zzz][8]?>
</div>
<? } ?>
<? if($Events[$zzz][0]=="alert"){?>
<h4 class="alertLink"><a href="#ci" onclick="getAlert(<?=$Events[$zzz][10]?>)"><?=switchThe($Events[$zzz][1])?></a></h4>
<div class="showinfo">
Where: <?=$Events[$zzz][8]?>
</div>
<? } ?>
</div><br/><br/>
<? } ?>
</div>
<div id="block_multimedia" class="block">
<div id="videoheader" class="sectionheader">
Multimedia
</div><br/><br/>
<!--<video controls style="margin-left:50px;">
<source src="images/Video/Jamie_Waier_WUD.webm" type="video/webm" />
</video>
<h2><em>Cast Interviews</em>('Wait Until Dark')</h2>-->
See video clips <a href="multimedia.php#videos">here!</a>
</div>
</div>
<div id="rightpane">
<div id="block_currentInfo" class="block"><a name="ci"></a>
<? if(($Events[0][0]=="audition")&&($Events[0][2]!="0000-00-00")){?>
<iframe src="viewAudInfo.php?aid=<?=$Events[0][12]?>&season=<?=$Events[0][6]?>&shownum=<?=$Events[0][10]?>"
scrolling="yes" frameborder="0" id="showDetails" name="showDetails" height="665" width="99%" />
<? } else if($Events[0][0]=="event"){?>
<iframe src="eventdetail.php?event=<?=$Events[0][10]?>"
scrolling="yes" frameborder="0" id="showDetails" name="showDetails" height="665" width="99%" />
<? } else if($Events[0][0]=="show"){?>
<iframe src="cast.php?season=<?=$Events[0][6]?>&shownum=<?=$Events[0][10]?>"
scrolling="yes" frameborder="0" id="showDetails" name="showDetails" height="665" width="98%">
<? } ?>
</iframe>
</div>
<div id="block_signup" class="block">
<div id="signupheader" class="sectionheader">
Stay Informed
</div>
How can you keep yourself informed of everything that TLT does, including audition announcements,
ticket sales, performance reviews and more? There is more than one way! Read more below:
<hr />
Join our email list. When TLT makes a major announcement, we always send out an email about it.
<?php if(isset($_COOKIE['emailadd'])){ ?>
<br /><strong>You are registered on our email list as: <br /><?=$_COOKIE['emailadd']?></strong>
<? } else{?>
Enter your email address to sign up for our email list:<span style="color:red;"><?=$errormsg?></span>
<form action="http://cwebsolutions.net/dada/mail.cgi" method="post" accept-charset="UTF-8" id="subscription_form">
Email: <input type="text" name="email" size="40"/>
<input type="submit" name="emailSub" value="Sign Up" />
</form>
<? }?>
<hr />
Social networking is hot! Join our <a href='http://www.facebook.com/#/group.php?gid=55791655556&ref=ts' target='_blank'><img src='images/fb_icon.jpg' style='border:none;' />Facebook goup</a> and follow us on <a href='http://twitter.com/tltjc' target='_blank'><img src='images/Twitter-icon.png' style='border:none;' />Twitter</a>. We update them often.
<hr />
Subscribe to our <a href='newsfeed.php'>RSS newsfeed</a>. You'll be able to see all of our recent news as soon as it's posted.
</div>
</div>
<? include "footer.php" ?>
</div></div></body>
</html>
答案 0 :(得分:1)
最有可能是在文档末尾使用普通和short open tag。特别是这一行:
<?php if(isset($_COOKIE['emailadd'])){ ?>
此行以普通标记打开。但if语句的结尾不是:
<? }?>
这会导致PHP断定文档在最后一行没有完成,因为它仍然期望得到一个close标记。
默认情况下,在新安装中禁用短打开标记。据推测,一个安装已启用,而另一个安装没有启用。在php.ini中启用短打开标签或用普通的开放标签替换它们。至少始终如一地使用相同的标签会导致更常规的行为。
答案 1 :(得分:0)
由于太多东西,Php代码会显示错误。他们中的一些人可能会考虑PHP的版本。如果您的PHP程序是最新的PHP 5或更高版本,则必须在PC中安装最新版本的Wamp。否则,它将显示这样的错误。