esolve
V2EX  ›  问与答

URLEncode 和 HTTP GET 参数

  •  
  •   esolve · Dec 19, 2017 · 1519 views
    This topic created in 3082 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   ·   947 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 21:39 · PVG 05:39 · LAX 14:39 · JFK 17:39
    ♥ Do have faith in what you're doing.