【文件属性】:
文件名称:如何通过PHP实现Des加密算法代码实例
文件大小:45KB
文件格式:PDF
更新时间:2020-12-18 07:57:37
加密 算法
如何通过PHP实现Des加密算法代码实例
注:php7以上不支持了,因为php7去掉了某些函数, 另外变量的{}要改为[]
<?php
class Des
{
/**
* 加密方法
*
* @param string $str 需要加密的内容
* @param string $key 密钥
* @param bool $toBase64 是否base64
* return string
*/
public function encrypt($str, $key, $toBase64=true)
{
if ($str == "