douqiao5552 2012-01-22 19:49
浏览 59

如何从url参数中读取Get值[关闭]

How can I read value in get parameter

http://www.localhost/type=Cars,-Vans-&-SUVs

When I am trying to read type value from get URL I am not able to read from &.

Please suggest how to read type variable value in Get method.

  • 写回答

2条回答 默认 最新

  • doufeng9567 2012-01-22 19:55
    关注

    the problem is , that & is a delimiter between GET-Keys.

    You have to urlencode the value of the "type" or any other key in your URL:

    Cars,-Vans-&-SUVs
    

    is urlencoded:

    Cars%2C-Vans-%26-SUVs
    

    if you try to get the value, only urldecode the value.

    In PHP the functions are urlencode() and urldecode().

    评论

报告相同问题?