The base64_encode and urlencode string encryption methods in php. This article introduces the simple encryption of strings using php's ase64_encode and urlencode, which is also a common method, if you need it, please refer to this article. This article introduces the simple encryption of strings using php's ase64_encode and urlencode, which is also a common method, if you need it, please refer to this article.
Base64_decode
Decodes a BASE64 encoded string.
Syntax: string base64_decode (string encoded_data );
Return value: string
Function type: encoding
Description
This function decodes strings encoded with MIME BASE64. The decoded string may be a Chinese string or other binary data.
Example
| The code is as follows: |
|
$ Str = 'vghpcybpcybhbiblbmnvzgvkihn0cmluzw = ';
Echo base64_decode ($ str );
?> |
Str urlencode ($ string)
This function is a convenient part of URL query when encoding strings. it is used as a convenient way to pass variables to the next page.
I wrote this simple function to create a GET query URL () from an array:
| The code is as follows: |
|
$ Query_string = 'foo = '. urlencode ($ foo).' & bar = '. urlencode ($ bar );
Echo '';
?> |
Look at two integrated functions.
| The code is as follows: |
|
$ Encryption = "username ";
Echo base64_encode ($ encryption); // echo "dXNlcm5hbWU = ";
Echo"
";
Echo urlencode ("http: //". $ encryption); // echo "http % 3A % 2F % 2 Fusername ";
Echo"
";
Echo sha1 ($ encryption); // echo "249ba36da-29bbe97499c03db5a9001f6b734ec"
Echo"
";
?> |
...