prepare($sql_str); $stmt->bindParam(':vol_no', $contractno); $stmt->execute(); $contract = $stmt->fetch(PDO::FETCH_ASSOC); $contractResponse = json_encode($contract); // 設定回應標頭為 JSON header('Content-Type: application/json'); // 將 JSON 回應返回給客戶端 echo json_encode($contract); }catch (PDOException $e ){ die("ERROR!!!: ". $e->getMessage()); } }