Home > Backend Development > PHP Tutorial > 请教,怎么写PHP加密算法

请教,怎么写PHP加密算法

WBOY
Release: 2016-06-13 13:12:28
Original
884 people have browsed it

请问,如何写PHP加密算法
看到有些PHP代码里全是经过加密后的乱码
那么执行是,是怎么处理的呢



我看到base64 好像只能加密单个字符,如果是一篇网页的话要如何加密呢
运行时又是如何还原呢?




------解决方案--------------------
base64 不是只加密单个字符

PHP code

 string base64_encode ( string $data )

base64_encode() returns 使用 base64 对 data 进行编码。设计此种编码是为了使二进制数据可以通过非纯 8-bit 的传输层传输,例如电子邮件的主体。

Base64-encoded 数据要比原始数据多占用 33% 左右的空间。

Example #1 base64_encode() 示例
<?php $str = 'This is an encoded string';
  echo base64_encode($str);
?>

此示例将显示:

VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw== <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template