HttpUtility.ParseQueryString 获取字符串URL中的参数

            string url = "https://i.cnblogs.com/EditPosts.aspx?opt=1&type=2";
            string param = url.Split('?')[1];
            string optParam = HttpUtility.ParseQueryString(param).Get("opt");
            string type = HttpUtility.ParseQueryString(param).Get("type");

 

posted @ 2018-02-02 14:19  巴蒂尔  阅读(497)  评论(0)    收藏  举报