procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); var FileContent: TStringList; begin FileContent := TStringList.Create; // 假设你的HTML文件位于Web服务器的根目录下,文件名为a01.html // FileContent.LoadFromFile( ExtractFilePath (ParamStr (0))+ '\a01.html'); FileContent.Add('<form action="upload" method="post">'); FileContent.Add('<input type="text" size="30" name="html" >'); FileContent.Add('<input type="submit" value="查询">'); FileContent.Add('</form>'); Response.Content := FileContent.Text; Response.ContentType := 'text/html; charset="UTF-8"'; Handled := True; FileContent.Free; end;
//ididom 成语 查询 procedure TWebModule1.WebModule1WebActionItem2Action(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); var S: string; aHTMLtext: TStringList; j:integer; begin s:=Request.ContentFields.Values['ihtml']; FDQuery1.Open('select * from atb where name like ''%' + s+'%''' ); //============================================================================== aHTMLtext := TstringList.Create; aHTMLtext.Add('<style> table{margin:0 auto;border:1px solid #000000;border-collapse:collapse;}th,td{border: 1px solid #000000;}' // 画 实细线 +'th {background-color: #007bff; color: #fff; font-weight: bold; text-align: center; padding: 10px; } ' //表头 样式 + 'tr:nth-child(odd) { background-color: #f2f2f2;} tr:nth-child(even) {background-color: #ffffff;}' // 正文 隔行 变色 +' </style>' ); aHTMLtext.Add(' <table border="1"; width=1000px; > ' ); aHTMLtext.Add(' <tr > '); for j := 1 to FDQuery1.FieldCount do begin aHTMLtext.Add('<th>'); aHTMLtext.Add(FDQuery1.Fields.FieldByNumber(j).FieldName); // 列 名 aHTMLtext.Add('</th>'); end; aHTMLtext.Add(' </tr> '); FDQuery1.First; while not(FDQuery1.Eof) do begin aHTMLtext.Add(' <tr > '); for j := 1 to FDQuery1.FieldCount do begin aHTMLtext.Add('<td>'); aHTMLtext.Add(FDQuery1.Fields.FieldByNumber(j).AsString); // 所有 值 aHTMLtext.Add('</td>'); end; aHTMLtext.Add(' </tr> '); FDQuery1.Next; end; aHTMLtext.Add('</table> '); S:= aHTMLtext.Text; aHTMLtext.Free ; //-------------------------------------------------------------------------- S:=StringReplace(s, 'Z~!~', '<br>', [rfReplaceAll]) ; s:='<input type="button" name="Submit" value="返回到主页" onclick="location.href=''http://127.0.0.1:8080/''" /> ' + s; Response.ContentType := 'text/html; charset="UTF-8"'; Response.Content := S; Handled := True; end;
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
2023-12-24 delphi10.3如何获得控件的On属性事件列表?
2023-12-24 Delphi 枚举转字符串