XLSB到CSV错误通过PHP



我找不到应该将XLSB文件转换为CSV的php脚本的问题。出于某种原因,它抛出了此解析错误。我尝试查看代码,但我不明白我做错了什么。

我遇到以下错误:

Parse error: syntax error, unexpected end of file in /storage/ssd3/577/2617577/public_html/XLSB2CSV/XLSB2CSV/index.php on line 163

我发布了索引.php并通过 ge.tt 网站共享了文件,这是 http://ge.tt/7k7vZDm2

指数

<?php 

$result=0;
if (isset($_POST["convert"])) { 
$filetoname = basename($_FILES['xlsbfile']['name']); 
if($filetoname==""){$alert = "Select a file";}else{
$ext = substr($filetoname,-4);
if($ext!="xlsb"){$alert = "Invalid file type. Select an .xlsb file.";}else{
$throttle=0;
//$throttle=preg_replace("/[^0-9]/","",$throttle);
$result = @move_uploaded_file($_FILES['xlsbfile']['tmp_name'], $filetoname); // upload it 
$file=$filetoname;
$throttle=0;
//Code for reading xlsb file
$workbook = new COM("EasyXLS.ExcelDocument");
$workbook->easy_LoadXLSBFile($file);
//Code for converting to CSV
$workbook->easy_WriteCSVFile("file.csv", $workbook->easy_getSheetAt(0)->getSheetName());

if(isset($_GET[$workbook]){  $csvFile = $workbook;
$alert = "Your download will start in <span id='timer'>5</span>
seconds<br/>or click <a href=$csvFile>this link</a> to start download now:";
$redir= '<meta http-equiv="refresh" content="5;url=index.php?file='.$csvFile.'">'; };
echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>XLSB TO CSV Web application</title>
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE"/>
<meta http-equiv="PRAGMA" content="NO-CACHE"/>
<meta http-equiv="EXPIRES" content="0"/>
<meta content="NONE" name="ROBOTS"/>
<meta content="JavaScript" name="vs_defaultClientScript"/>
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"/>
<link href="style_new.css" type="text/css" rel="stylesheet"/>
<script language="javascript" src="_js/jsCommon.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
/*if(document.location.href.indexOf('https')>-1){
document.location = document.location.href.replace('https', 'http');
}*/
function findPosX(obj){
var curleft = 0;
if (obj.offsetParent){
while (obj.offsetParent){
curleft += obj.offsetLeft;
obj = obj.offsetParent;
}
}else if (obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(obj){
var curtop = 0;
if (obj.offsetParent){
while (obj.offsetParent){
curtop += obj.offsetTop;
obj = obj.offsetParent;
}
}else if (obj.y)
curtop += obj.y;
return curtop;
}
function showTooltip(objDiv, strMessage, e){
getID('divToolti').style.display = 'block';
getID('divTooltip').innerHTML = strMessage;
objDiv.onmousemove = function(e){
if(typeof e=='undefined')
e = window.event;
getID('divTooltip').style.left = e.clientX - (getID('divTooltip').offsetWidth / 2);
getID('divTooltip').style.top = e.clientY + 20 + document.body.scrollTop;
}
}
function hideTooltip(objDiv){
getID('divTooltip').style.display = 'none';
getID('divTooltip').style.left = -200;
getID('divTooltip').style.top = -50;
objDiv.onmousemove = null;
}
</script>
</head>
<body>
<div class="clsPanelText" id="divTooltip" style="border-right:#666 1px solid;padding-right:4px;border-top:#666 1px solid;display:none;padding-left:4px;padding-bottom:4px;border-left:#666 1px solid;padding-top:4px;border-bottom:#666 1px solid;position:absolute;background-color:#fff"></div>
<form name="Form1" method="post" action="index.php" id="Form1" enctype="multipart/form-data">
<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr valign="middle">
<td align="center">
<div id="pnlDemoFirstStep" style="text-align:center;">
<table class="clsPanelText" cellspacing="0" cellpadding="0" width="900" align="center" style="position:relative;top:10px" border="0">
<tr>
<td>
<div class="clsH3" align="middle">
XLSB TO CSV Converter Web Application
</div><br/><br/>
<br/>
<span class="clsH3">Step One:</span> 
Please select the Excel file you saved on your local hard 
drive with your data and convert it back into downloadbale CSV into this website.<br/>
</td>
</tr>
<tr>
<td style="padding-left:140px"><br/>
<img style="vertical-align:middle" src="step1.jpg" alt="Step 3"/> 
<b>Upload the Excel file</b><br/><br />
<table class="clsPanelText" cellspacing="0" cellpadding="10" width="620" border="0" style="border:solid 1px #DDD;background-color:#eaf0f0">
<tr>
<td valign="bottom">
Upload the XLSB template:<br/>
<input type="hidden" name="convert">
<input name="xlsbfile" type="file" id="txtUploadTemplate" class="clsInputText6" oncontextmenu="this.blur();" onkeydown="this.blur();" style="width:390px;height:24px" size="61" />
<input type="submit" name="btnUploadXLS" value="Upload XLSB template" id="btnUploadXLS" class="clsButton1" onmouseover="this.style.backgroundColor='#80B3C4'" onmouseout="this.style.backgroundColor='#22769D'" style="width:170px;" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<table class="clsPanelText" cellspacing="0" cellpadding="0" width="900" align="center" style="position:relative;top:10px" border="0">
<tbody>
<tr>
<td style="padding-left:140px"><br>
<img style=" vertical-align:middle" src="step2.jpg" alt="Step 2"> 
<b>Generate custom CSV file</b><br><br>
<table class="clsPanelText" cellspacing="0" cellpadding="10" width="620" border="0" style="border:solid 1px #DDD;background-color:#eaf0f0">
<tbody><tr>
<td>
$alert;
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
</tr>
</tbody></table>
</div>
</td>
</tr>
</table>
</form>
<script language="javascript" type="text/javascript">
window.history.forward();
</script>
<script language="javascript" src="_js/jsAnalytics.js" type="text/javascript"></script>
</body>
</html>
';
?>

您在此处缺少右括号

if(isset($_GET[$workbook])) //<--- this one

相关内容

  • 没有找到相关文章

最新更新