delphi 获取 Web请求地址中的Query的参数值  
官方Delphi 学习QQ群: 682628230(三千人)
频道

delphi 获取 Web请求地址中的Query的参数值


delphi 获取 Web请求地址中的Query的参数值



一、Web请求示例


http://域名/wxauth.do?page=policy_product_list&pubid=gh_0r5943e2d1a9&opercode=00081001&productid=1&db=wxsmrs


如果需要获取具体的参数值,使用正则表达式函数如下:


function Get_Query_Param_Value(QueryStr,Param_Name : string) : string;

 var

  Reg    : TRegEx;

  Match  : TMatch;

 begin

   Result := '';

   Match := Reg.Match(QueryStr,'(?<=' + Param_Name + '=)[^&]*');

   if Match.Success then

      Result := Match.Value;

 end;

二、函数说明

如果需要获取page参数,则:


QueryStr := 'http://域名/wxauth.do?page=policy_product_list&pubid=gh_0r5943e2d1a9&opercode=00081001&productid=1&db=wxsmrs'


sPage := Get_Query_Param_Value(QuesyStr, 'page' );


结果:sPage = 'policy_product_list'

————————————————


原文链接:https://blog.csdn.net/sensor_WU/article/details/106985818



推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 0.040101051330566 seconds