Home  >  Article  >  php教程  >  php base64加密解密的实现代码

php base64加密解密的实现代码

WBOY
WBOYOriginal
2016-06-07 11:34:421293browse

本节内容:
使用PHP自带的函数 base64_encode()、base64_decode()实现加密、解密。
例1,base64_encode()函数加密


代码示例:
//加密
$str = '黑帽联盟www.heimaolianmeng.com';
echo base64_encode($str);
?>
显示utrDscGqw8t3d3cuaGVpbWFvbGlhbm1lbmcuY29t


例2,base64_decode()函数解密
代码示例:
$str = 'utrDscGqw8t3d3cuaGVpbWFvbGlhbm1lbmcuY29t';
echo base64_decode($str);
?>
显示:黑帽联盟www.heimaolianmeng.com

PHP参数调用示例:
代码示例:
$str = $url;
echo base64_decode($str);
?>

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn