V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
esolve
V2EX  ›  问与答

URLEncode 和 HTTP GET 参数

  •  
  •   esolve · Dec 19, 2017 · 1492 views
    This topic created in 3063 days ago, the information mentioned may be changed or developed.

    我的一个 http 请求大致如下:

    api/getFoodId?encPhoneNo=J+Bky+VyLl8TwHcwIwAO7w==
    

    由于加密后的手机号有+符号,我对其进行 URLEncode

    结果大致为:

    api/getFoodId?encPhoneNo=P6RPO8%2FVjDxd68nbdydytQ%3D%3D
    

    这样是 OK 的,能获得正确结果

    但是如果有多个参数,譬如

    api/getFoodId?type=cm&encPhoneNo=J+Bky+VyLl8TwHcwIwAO7w==
    

    这时对手机号进行 URLEncode,就不行了

    api/getFoodId?type=cm&encPhoneNo=P6RPO8%2FVjDxd68nbdydytQ%3D%3D
    

    请问为何?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1089 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 23:30 · PVG 07:30 · LAX 16:30 · JFK 19:30
    ♥ Do have faith in what you're doing.