Why use the UrlEncode () function for URL encoding

Source: Internet
Author: User

UrlEncode is to encode a special part of the URL. Urldecoder is the decoding of special parts.

Because when string data is passed to the Web server as a URL, spaces and special characters are not allowed in the string.

For example, when you want to pass the string data Name=lisi&wangwu here Lisi&wangwu is a string but the server will only recognize Lisi

So we're going to use UrlEncode to encode this string.

So here's the problem!!! I'm particularly interested in getting multiple values of the same parameter with the Get method

The NAME=LISI&WANGWU is represented by two values------->>>> here are two ways of saying

1) UrlEncode encode and then decode with UrlDecode you can get $name=$_get[' Name]=lisi&wangwu

Two or more values of the name parameter can be obtained with explode (' & ', $name)

2) It is also possible to pass the $url= ' Www.baidu.com?name=lisi&name=wangwu ';

$name =$_sever[' uery_string ') so you can get the URL suffix name=lisi&name=wangwu ';

Then still get the array $name=explode (' & ', $name);

The last step is to intercept the string $name0=substr ($name [0],5)//name= with a length of 5

$name 0=substr ($name [1],5]

$name 0=substr ($name [2],5]

Why use the UrlEncode () function for URL encoding

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.