Home >Backend Development >PHP Tutorial >Base64_encode and urlencode string encryption methods in php_PHP tutorial
This article introduces the use of PHP's ase64_encode and urlencode to simply encrypt strings. It is also a relatively common method. Students in need can refer to this article.
base64_decode
Decode a BASE64 encoded string.
Syntax: string base64_decode(string encoded_data);
Return value: String
Function type: Encoding processing
Content Description
This function will decode a MIME BASE64 encoded string. The decoded string may be a Chinese string or other binary data.
Example
The code is as follows
|
Copy code
|
||||||||
$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw=='; echo base64_decode($str); ?>
str urlencode($string) This feature is handy when encoding strings to be used as part of a query in the URL as a convenient way to pass variables to the next page.I wrote this simple function that creates a GET query for the url() from an array:
|
The code is as follows |
The code is as follows | Copy code |
";
echo urlencode("http://".$encryption);//echo " http%3A%2F%2Fusername ";
echo ""; echo sha1($encryption);//echo "249ba36000029bbe97499c03db5a9001f6b734ec" echo " "; ?> http://www.bkjia.com/PHPjc/629677.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629677.htmlTechArticleThis article introduces the use of php's ase64_encode and urlencode to perform simple encryption processing of strings. It is also a comparison Commonly used methods, students in need can refer to this article... |