使用ms excel文件导入excel时,无法正常工作
Array ( [0] => 42000 [1] => 1065 [2] => Query was empty )
Warning: A non-numeric value encountered in C:\xampp\htdocs\Classes\PHPExcel\Shared\Date.php on line 135
Warning: A non-numeric value encountered in C:\xampp\htdocs\Classes\PHPExcel\Shared\Date.php on line 136
Warning: A non-numeric value encountered in C:\xampp\htdocs\Classes\PHPExcel\Shared\Date.php on line 137
Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\Classes\PHPExcel\CachedObjectStorage\CacheBase.php on line 196
date.php
if ($dateValue >= 1) {
$utcDays = $dateValue - $myexcelBaseDate;
$returnValue = round($utcDays * 86400);
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
$returnValue = (integer) $returnValue;
}
} else {
$hours = round($dateValue * 24);
$mins = round($dateValue * 1440) - round($hours * 60);
$secs = round($dateValue * 86400) - round($hours * 3600) - round($mins * 60);
$returnValue = (integer) gmmktime($hours, $mins, $secs);
}
但是它正在为自由办公室工作。任何帮助将不胜感激。
答案 0 :(得分:1)
我认为您可以将其转换为整数$dateValue = (int)$dateValue;
假设else下面的线是135、136、137
if ($dateValue >= 1) {
$utcDays = $dateValue - $myexcelBaseDate;
$returnValue = round($utcDays * 86400);
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
$returnValue = (integer) $returnValue;
}
} else if ($dateValue < 0){
$dateValue = (int)$dateValue;
$hours = round($dateValue * 24);
$mins = round($dateValue * 1440) - round($hours * 60);
$secs = round($dateValue * 86400) - round($hours * 3600) - round($mins * 60);
$returnValue = (integer) gmmktime($hours, $mins, $secs);
}
此外,有时您必须增加执行时间,您可以通过以下方式做到这一点:
set_time_limit(60); // 60 seconds.