加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

Base64在线编码解码实现代码 演示与下载

发布时间:2020-05-24 20:39:08 所属栏目:PHP 来源:互联网
导读:最近遇到的几个程序的加密方式都是Base64加密,很是晕菜,临时整了个在线转换,但是也不全部能搞定,呵呵也许还有不行的,希望对后来人有所帮助。

在线演示地址:
gb2312版本 http://tools.jb51.cc/tools/base64_decode-gb2312.php
utf8版本 http://tools.jb51.cc/tools/base64_decode-utf8.php
<div class="codetitle"><a style="CURSOR: pointer" data="28910" class="copybut" id="copybut28910" onclick="doCopy('code28910')"> 代码如下:<div class="codebody" id="code28910">
<?php
header('Content-Type: text/html; charset=gb2312');
$txt1 = stripslashes(trim( @$_POST['text1']));
$button = @$_POST['button'];
$down = @trim($_GET['down']);
if ($down==1) {
header("Content-type: command");
header("Content-Disposition: attachment; filename=base64_decode.txt");
$contents = file_get_contents(basename($_SERVER['PHP_SELF']));
echo $contents;
exit;
}
?>
<html xmlns="http://www.w3.org/1999/xhtml"&gt;

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta content="Base64在线编码解码" name="keywords">
Base64在线编码解码 gb2312

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="100%">
<tr><td height="20" bgcolor="#CCCCCC" align =right style="padding-right:5px;">
</td></tr><tr>

<form name="form1" method="post" action="">

Base64在线编码解码 gb2312 <a href="?down=1">源码下载



请输入转换的地址:
<textarea name="text1" rows="14" class="bginput" style="width:520px;"><?php echo htmlspecialchars($txt1,ENT_QUOTES);?>


请选择转换的方式:
<textarea rows="14" class="bginput" style="width:520px;"><?php
if($button=="编码") echo base64_encode($txt1);
if($button=="解码") echo mb_convert_encoding(base64_decode($txt1),"gb2312","UTF-8");
?>








</td></tr>
<tr><td height="10"></td></tr><tr>
</td>
</tr>
</table>


(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读