之前我们分享了discuz的authocode的加密解密函数,还有Thinkphp之App传参加密解密实例展示。今天再介绍一款强大的加密和解密类:AES
加密和解密表单
<div class="row" style="margin-top: 30px">
<div class="col-md-6 col-md-offset-3">
<p>输入要加密的内容:</p>
<textarea class="form-control" rows="3" id="input">www.sucaihuo.com 欢迎您!</textarea>
</div>
<div class="col-md-6 col-md-offset-3 text-center" style="margin-top:20px">
<button type="button" class="btn btn-info" id="doit">点击加密</button>
</div>
<div class="col-md-6 col-md-offset-3">
<p>加密结果:</p>
<textarea class="form-control" rows="3" id="output"></textarea>
</div>
<div class="col-md-6 col-md-offset-3 text-center" style="margin-top:20px">
<button type="button" class="btn btn-warning" id="doit2">点击解密</button>
</div>
<div class="col-md-6 col-md-offset-3">
<p>解密结果:</p>
<textarea class="form-control" rows="3" id="output2"></textarea>
</div>
</div>
引入AES类库,根据Ajax传过来的参数进行解密
require_once('aes.php');
$action = @$_GET['action'];
$str = trim(@$_POST['str']);
if (empty($str)) exit('内容不能为空!');
$key = 'www.sucaihuo.com'; //密钥
$aes = new Aes($key);
if ($action == 'en') {
$str = $aes->encrypt($str);
} else {
$str = $aes->decrypt($str);
}
echo $str;
Thinkphp安卓IOS等第三方接口加密http://www.sucaihuo.com/php/1263.html
PHP仿discuz秘钥authocode的加密解密函数http://www.sucaihuo.com/php/245.html
系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791