phpexcel 读取excel 总是找不到文件
$File=$_FILES['fileToUpload'];if($_FILES!=''){$FileName='';if($File['error']==0){$dir...
$File=$_FILES['fileToUpload'];
if($_FILES!=''){
$FileName='';
if($File['error']==0){
$dir='upload/wageshare/';
if(!is_dir($dir))mkdir($dir,0777);//赋予操作某一个文件夹的权限
$Tmparr=explode('.', $File["name"]);
$NewFileName=CreateFileName($dir, $Tmparr[0],$Tmparr[1]);//得到文件路径
$FileName=$NewFileName.'.'.$Tmparr[1];
$FullFileName=$dir.$FileName;
if(move_uploaded_file($File["tmp_name"],$FullFileName)){//拷贝文件到指定的服务器文件夹,并且判断是不是拷贝成功
$RefArr = array();
require_once 'Library/php/PHPExcel.php';
$PHPExcel = new PHPExcel();
$PHPReader = new PHPExcel_Reader_Excel2007();
if(!$PHPReader->canRead($FullFileName)){
$PHPReader = new PHPExcel_Reader_Excel5();
if(!$PHPReader->canRead($FullFileName)){
echo 'no Excel';
echo $FullFileName;
return ;
}
}
$PHPExcel = $PHPReader->load($FullFileName);
$currentSheet = $PHPExcel->getSheet(0);
/**取得一共有多少列*/
$allColumn = $currentSheet->getHighestColumn();
/**取得一共有多少行*/
$allRow = array($currentSheet->getHighestRow());
for($currentRow = 1;$currentRow<=$allRow;$currentRow++){
for($currentColumn='A';$currentColumn<=$allColumn;$currentColumn++){
$address = $currentColumn.$currentRow;
echo $currentSheet->getCell($address)->getValue()."\t";
}
echo "\n";
}
}
}
}
请高手指教一下是路径不对还是怎么的? 展开
if($_FILES!=''){
$FileName='';
if($File['error']==0){
$dir='upload/wageshare/';
if(!is_dir($dir))mkdir($dir,0777);//赋予操作某一个文件夹的权限
$Tmparr=explode('.', $File["name"]);
$NewFileName=CreateFileName($dir, $Tmparr[0],$Tmparr[1]);//得到文件路径
$FileName=$NewFileName.'.'.$Tmparr[1];
$FullFileName=$dir.$FileName;
if(move_uploaded_file($File["tmp_name"],$FullFileName)){//拷贝文件到指定的服务器文件夹,并且判断是不是拷贝成功
$RefArr = array();
require_once 'Library/php/PHPExcel.php';
$PHPExcel = new PHPExcel();
$PHPReader = new PHPExcel_Reader_Excel2007();
if(!$PHPReader->canRead($FullFileName)){
$PHPReader = new PHPExcel_Reader_Excel5();
if(!$PHPReader->canRead($FullFileName)){
echo 'no Excel';
echo $FullFileName;
return ;
}
}
$PHPExcel = $PHPReader->load($FullFileName);
$currentSheet = $PHPExcel->getSheet(0);
/**取得一共有多少列*/
$allColumn = $currentSheet->getHighestColumn();
/**取得一共有多少行*/
$allRow = array($currentSheet->getHighestRow());
for($currentRow = 1;$currentRow<=$allRow;$currentRow++){
for($currentColumn='A';$currentColumn<=$allColumn;$currentColumn++){
$address = $currentColumn.$currentRow;
echo $currentSheet->getCell($address)->getValue()."\t";
}
echo "\n";
}
}
}
}
请高手指教一下是路径不对还是怎么的? 展开
若以下回答无法解决问题,邀请你更新回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询