Doc.Utility/TextMethod.cs

(完整代码) 1KB

using System.Web;
namespace Doc.Utility
{
    public class TextMethod
    {

        public static string Post(string key)
        {
            var str = string.Empty;
            if (HttpContext.Current.Request.Form[key] != null)
            {
                str = HttpContext.Current.Request.Form[key];
            }
            return str;
        }

        public static string Get(string key)
        {
            var str = string.Empty;
            if (HttpContext.Current.Request.QueryString[key] != null)
            {
                str = HttpContext.Current.Request.QueryString[key];
            }
            return str;
            ;
        }

        public static string GetAndPost(string p_key)
        {
            var str = string.Empty;
            if (HttpContext.Current.Request.QueryString[p_key] != null)
            {
                str = HttpContext.Current.Request.QueryString[p_key];
            }
            if (string.IsNullOrWhiteSpace(str) && HttpContext.Current.Request.Form[p_key] != null)
            {
                str = HttpContext.Current.Request.Form[p_key];
            }
            return str;
        }

        /// <summary>
        ///     获取多个同名name的值,返回数组
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string[] Params(string key)
        {
            string[] arr = null;
            if (HttpContext.Current.Request.Params.GetValues(key) != null)
            {
                arr = HttpContext.Current.Request.Params.GetValues(key);
            }
            return arr;
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。