Home >Backend Development >PHP Tutorial >php中base64_decode与base64_encode加密解密函数实例_PHP

php中base64_decode与base64_encode加密解密函数实例_PHP

WBOY
WBOYOriginal
2016-05-31 18:15:37902browse

本文实例讲述了php中base64_decode与base64_encode加密解密函数。分享给大家供大家参考。具体分析如下:

这两个函数在php中是用得对php代码进行加密与解密码的base64_encode是加密,而base64_decode是解密了,下面我们看两个简单实例.

base64_encode语法:string base64_decode(string data);

代码如下:

$str='d3d3LmpiNTEubmV0IOiEmuacrOS5i+Wutg==';     //定义字符串
echo base64_decode($str); //输出解码后的内容


base64_encode语法:string base64_encode(string data);

代码如下:

$str='www.bitsCN.com '; //定义字符串
echo base64_encode($str);  // 输出编码后的内容为: d3d3LmpiNTEubmV0IOiEmuacrOS5i+Wutg==

希望本文所述对大家的PHP程序设计有所帮助。

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