Home  >  Article  >  php教程  >  php中base64_decode与base64_encode加密解密函数实例

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

WBOY
WBOYOriginal
2016-06-06 20:16:511617browse

这篇文章主要介绍了php中base64_decode与base64_encode加密解密函数,实例分析了base64加密解密函数的具体用法,具有一定的实用价值,需要的朋友可以参考下

本文实例讲述了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.jb51.net 脚本之家'; //定义字符串
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
Previous article:浅析php原型模式Next article:浅析php创建者模式