<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ~~~ <?php if (!function_exists('json')) { //輸出JSON格式的結果集 function json($code, $message, $data = null) { $result = array( "errno" => $code, "errmsg" => $message, "data" => $data, ); $json = json_encode($result); header('Content-Type:text/json'); echo $json; } } //數據庫連接部分--開始 $servername = "localhost"; //數據庫服務器名稱 $username = "root"; // 連接數據庫用戶名 $password = "root"; // 連接數據庫密碼 $database = "quickstart"; // 數據庫的名字 // 創建連接 $conn = new mysqli($servername, $username, $password, $database); // 檢測連接 if ($conn->connect_error) { die("連接失敗: " . $conn->connect_error); } $action = isset($_GET['action']) ? $_GET['action'] : ''; if ($action == 'getBookList') { $bookList = getBookList(); json(0, '', $bookList); } else if ($action == 'getBookInfo') { //從數據庫中查詢 $id = isset($_GET['id']) ? $_GET['id'] : null; if ($id) { $book = getBookInfo($id); } else { $book = null; } json(0, '', $book); } else if ($action == 'updateBookInfo') { $result = updateBookInfo(); json(0, '', $result); } else if ($action == 'addBookInfo') { $result = addBookInfo(); json(0, '', $result); } else if ($action == 'deleteBookInfo') { $id = isset($_POST['id']) ? $_POST['id'] : null; $result = deleteBookInfo($id); json(0, '', $result); } else { json(1000, '錯誤的請求'); } $conn->close(); //關閉連接 /*--結束*/ /** * 獲取圖書列表 */ function getBookList() { global $conn; $sql = "select * from think_book"; $result = $conn->query($sql); $data = []; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $data[] = $row; } } return $data; } /** * 獲取圖書信息 */ function getBookInfo($id) { global $conn; $sql = "select * from think_book where id=" . $id; $result = $conn->query($sql); $data = null; if ($result->num_rows > 0) { $data = $result->fetch_assoc(); } return $data; } function updateBookInfo() { global $conn; // 預處理及綁定 $stmt = $conn->prepare("update think_book set title=?, author=?, publisher=?, pub_year=?, price=? where id=?"); $stmt->bind_param("ssssds", $title, $author, $publisher, $pub_year, $price, $id); // 設置參數并執行 $id = isset($_POST['id']) ? $_POST['id'] : ''; $title = isset($_POST['title']) ? $_POST['title'] : ''; $author = isset($_POST['author']) ? $_POST['author'] : ''; $publisher = isset($_POST['publisher']) ? $_POST['publisher'] : ''; $pub_year = isset($_POST['pub_year']) ? $_POST['pub_year'] : null; $price = isset($_POST['price']) ? $_POST['price'] : null; $stmt->execute(); $stmt->close(); return array( 'id' => $id, 'title' => $title, 'author' => $author, 'publisher' => $publisher, 'pub_year' => $pub_year, 'price' => $price ); } function deleteBookInfo($id) { global $conn; $sql = "DELETE from think_book where id=" . $id; $result = $conn->query($sql); return $result; } function addBookInfo() { global $conn; // 預處理及綁定 $stmt = $conn->prepare("INSERT INTO think_book(title, author, publisher, pub_year, price) VALUES (?, ?, ?, ?, ?)"); $stmt->bind_param("ssssd", $title, $author, $publisher, $pub_year, $price); // 設置參數并執行 $title = isset($_POST['title']) ? $_POST['title'] : ''; $author = isset($_POST['author']) ? $_POST['author'] : ''; $publisher = isset($_POST['publisher']) ? $_POST['publisher'] : ''; $pub_year = isset($_POST['pub_year']) ? $_POST['pub_year'] : null; $price = isset($_POST['price']) ? $_POST['price'] : null; $stmt->execute(); $stmt->close(); return $conn->insert_id; //返回新增記錄的ID } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看