"", 2 => "", ]; $i = 1; foreach ($result as $key => $row) { $_fire = new stdClass(); $_fire->colname = "火災"; $_fire->icon = "#"; $_fire->desc = "動作後取消呼梯指令,返基站開門停機"; $_screen = new stdClass(); $_screen->colname = "光幕"; $_screen->icon = "#"; $_screen->desc = "光束被遮斷時,重新開門"; $_special_use = new stdClass(); $_special_use->colname = "專用"; $_special_use->icon = "#"; $_special_use->desc = "VIP模式,只回应轎內指令"; $_open_lengthen = new stdClass(); $_open_lengthen->colname = "開延長"; $_open_lengthen->icon = "#"; $_open_lengthen->desc = "延長電梯的開門保持時間"; $_fully_loaded = new stdClass(); $_fully_loaded->colname = "滿載行駛"; $_fully_loaded->icon = "#"; $_fully_loaded->desc = "滿載時沿途層站不停靠"; $_returning = new stdClass(); $_returning->colname = "再平層"; $_returning->icon = "#"; $_returning->desc = "載重變化時,自動識別並重新拉平層"; $row['fire'] = $_fire; $row['screen'] = $_screen; $row['special_use'] = $_special_use; $row['open_lengthen'] = $_open_lengthen; $row['fully_loaded'] = $_fully_loaded; $row['returning'] = $_returning; $response[$i++] = $row; continue; } $flag = false; $start = $start + $i - 1; for ($j = 1; $j <= count($response); $j++) { if (!is_object($response[$j]) && !is_array($response[$j])) { $response[$j] = new Item($seq); $start = 0; } } #設定下次七點 04 $response[0] = ($count == $start) ? 0 : ($start); echo json_encode($response); mysqli_close($link); } function getHostData($seq, $start) { global $link; if (empty($seq)) return json_encode([]); $sql = "select *From kanban_host where seq='$seq' "; list($count) = mysqli_fetch_row(mysqli_query($link, "select count(*) cnt from kanban_host where seq='$seq' ")); // echo $sql; $result = mysqli_fetch_all(mysqli_query($link, $sql), MYSQLI_ASSOC); $response = $result; #設定下次起點 $response[0] =0; $response[1] =$result; echo json_encode($response); mysqli_close($link); }