php base64安全吗,php base64
場(chǎng)景:PHP 用base64兌現(xiàn)加密解密
PHP 用base64實(shí)現(xiàn)加密解密
php中用base64實(shí)現(xiàn)加密解密: ?? base64_encode() 和 base64_decode() 進(jìn)行加密和解密.
語(yǔ)法:??? string base64_encode ( string data )
使用 base64 對(duì) data 進(jìn)行編碼。設(shè)計(jì)此種編碼是為了使二進(jìn)制數(shù)據(jù)可以通過非純 8-bit 的傳輸層傳輸,例如電子郵件的主體。
Base64-encoded 數(shù)據(jù)要比原始數(shù)據(jù)多占用 33% 左右的空間。
語(yǔ)法:???? string base64_decode ( string encoded_data )
base64_decode() 對(duì) encoded_data 進(jìn)行解碼,返回原始數(shù)據(jù),失敗則返回 FALSE。返回的數(shù)據(jù)可能是二進(jìn)制的。
例子 1. base64_encode() 示例
$str = 'This is an encoded string';
echo base64_encode($str);
?>
此例將顯示:
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==
例子 2. base64_decode() 示例
$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo base64_decode($str);
?>
此例將顯示:
This is an encoded string
總結(jié)
以上是生活随笔為你收集整理的php base64安全吗,php base64的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 老外《战神》系列排名 毫无疑问《战神4》
- 下一篇: 2022新一线城市名单公布:沈阳跌出!快