PHP的几个常用加密函数(2)

string base64decode ( string $encodeddata )
1.base64_encode()接受一个参数,也就是要编码的数据(这里不说字符串,是因为很多时候base64用来编码图片)
2.base64encode()为双向加密,可用base64decode()来解密

echo base64_encode($my_intro); echo "<hr>"; /*输出:SmVsbHlCb29s5piv5LiA5Liq6Lqr5p2Q5pyJ6auY5bqmLOiCqeiGgOacieWuveW 6pizog7jogozmnInljprluqYs5oCd5oOz5pyJ5rex5bqm55qE5Zu95a625YWN5qOA5Lq UQee6p+S8mOi0qOS8quWJjeerr0lU55S35bGM5Lid */ echo base64_decode('SmVsbHlCb29s5piv5LiA5Liq6Lqr5p2Q5pyJ6auY5bqmLOiCqeiGg OacieWuveW6pizog7jogozmnInljprluqYs5oCd5oOz5pyJ5rex5bqm55qE5Zu95a6 25YWN5qOA5LqUQee6p+S8mOi0qOS8quWJjeerr0lU55S35bGM5Lid'); /*输出:JellyBool是一个身材有高度,肩膀有宽度,胸肌有厚度,思想有深度的国家免检五A 级优质伪前端IT男屌丝 */

一个图片的例子:

<?php /* 一个图片的应用例子 */ $filename="https://worktile.com/img/index/index_video.png"; $data=file_get_contents($filename); echo base64_encode($data); /*然后你查看网页源码就会得到一大串base64的字符串, 再用base64_decode()还原就可以得到图片 */

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/38dbc4bb826f189e690783082df12a47.html