我使用http://www.000webhost.com/作为网络服务器。我的代码在本地主机上完美运行,但在线我收到此错误
解析错误:语法错误,第 1 行 /home/a1582910/public_html/setcore/create.php 中的意外 T_STRING
我无法修复它,因为我不明白这个问题,因为你知道代码在一行中,所有代码都在第一行中:D 所以
搜索后我发现变量的名称是区分大小写的,所以我全部用小写字母,我仍然有同样的错误。
任何人都可以帮忙吗?
我正在使用 WAMPSERVER (32 BITS & PHP 5.4) create.php 包含以下内容
<html>
<head>
</head>
<body>
<?php
class invoice {
function addninvoice ($i) {
require_once 'PHPExcel_1.7.9_doc/Classes/PHPExcel.php';
/** PHPExcel */require_once 'PHPExcel_1.7.9_doc/Classes/PHPExcel/IOFactory.php';
$excel2 = PHPExcel_IOFactory::createReader('Excel2007');
$excel2 = $excel2->load('try.xlsx');
$excel2->setActiveSheetIndex(0);
echo"".$excel2->getActiveSheet()->getHighestRow()."";
$psheet = $excel2->getActiveSheet();
$excel22 = PHPExcel_IOFactory::createReader('Excel2007');
$excel22 = $excel22->load('try.xlsx');
$psheet->setTitle($i);
$psheet->setCellValue('G7', $i);
$excel22->addSheet($psheet);
$obr = PHPExcel_IOFactory::createWriter($excel22, 'Excel2007');
$obr->save('try1.xlsx');
$excel222 = PHPExcel_IOFactory::createReader('Excel2007');
$excel222 = $excel222->load('try1.xlsx');
$o = PHPExcel_IOFactory::createWriter($excel222, 'Excel2007');
$o->save('try.xlsx');
}
}
$p=new invoice;
$in = $_GET['in'];
require_once 'PHPExcel_1.7.9_doc/Classes/PHPExcel/IOFactory.php';
$excel2 = PHPExcel_IOFactory::createReader('Excel2007');
$sna = $excel2->listWorksheetNames("try.xlsx");
$df=0;
foreach($sna as $id => $name ){
if($name==$in){ $df++; }
}
if($df != 0){
echo"this invoice already exist
you can not create two invoices with the same name
if you want to edit it just click on it from the left menu in the home page" ;
}else{
$p->addninvoice($in);
?><meta http-equiv="Refresh" content="0; url=fa.php"><?php
}
?>
</body>
</html>
fa.php
<html>
<head>
<script>
function validateForm()
{
var x=document.forms["numrownamche"]["in"].value;
if (x==null || x=="")
{
alert("Invoice Name Must Be Filled Out");
return false;
}
}
</script>
</head>
<body bgcolor="silver">
<img src="image/Logo.gif" alt="Setcore" width="199">
<b>create new invoice</b>
<form name="numrownamche" action="create.php" onsubmit="return validateForm()" method="get">
<br/><small>invoice number:</small> <input type="text" name="in">
<input type="submit" value="Create">
</form>
<?php
require_once 'PHPExcel_1.7.9_doc/Classes/PHPExcel/IOFactory.php';
$excel2 = PHPExcel_IOFactory::createReader('Excel2007');
$sna = $excel2->listWorksheetNames("try.xlsx");
foreach($sna as $id => $name ){
?>
<a href="fb.php?shtid=<?php echo $id; ?>" target="fb"><?php echo "".$name."<br/>";?> </a>
<?php
}
?>
</body>
</html>