|
|
@@ -7,8 +7,7 @@ require '../../assets/vendor/autoload.php';
|
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
|
|
|
|
|
-session_start();
|
|
|
-if (isset($_POST["excel"])) {
|
|
|
+if (isset($_FILES["excel"])) {
|
|
|
if (0 < $_FILES['excel']['error']) {
|
|
|
echo 'Error: ' . $_FILES['excel']['error'] . '<br>';
|
|
|
} else {
|
|
|
@@ -59,7 +58,14 @@ if (isset($_POST["excel"])) {
|
|
|
$col_count = 0;
|
|
|
array_push($row, $date);
|
|
|
if (str_contains($sheetName, "SIS") || str_contains($sheetName, "SID")) { //若為SIS取出儀器名稱
|
|
|
- $equipment_name = explode("區", $sheetName)[1];
|
|
|
+ if(str_contains($sheetName,"區")){
|
|
|
+ $equipment_name = explode("區", $sheetName)[1];
|
|
|
+ }
|
|
|
+ if(str_contains($sheetName,"(")){
|
|
|
+ $temp = explode("(", $sheetName);
|
|
|
+ $equipment_name = $temp[0].$temp[1];
|
|
|
+ }
|
|
|
+
|
|
|
$equipment_name = str_replace(" ", "", $equipment_name);
|
|
|
$col_count++;
|
|
|
array_push($row, $equipment_name);
|