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


Posted in PHP onJanuary 08, 2011

在线演示地址:
gb2312版本 http://tools.3water.com/tools/base64_decode-gb2312.php
utf8版本 http://tools.3water.com/tools/base64_decode-utf8.php

<?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"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<meta content="Base64在线编码解码" name="keywords"> 
<title>Base64在线编码解码 gb2312</title> 
<style> 
P { 
FONT-SIZE: 9pt; 
line-height:150%; 
width:50%; 
BORDER:#DDDDDD 1px solid; 
padding:5px 5px 5px 5px;text-align:justify; 
} 
A { 
text-decoration: none; 
font-size:9pt; 
color:blue 
} 
A:hover { 
COLOR: red; 
TEXT-DECORATION: underline 
} 
h1 { 
font-size:12pt; 
text-align:center; 
margin-top:30px; 
font-family: 微软雅黑, msyh, Tahoma, Helvetica, sans-serif; 
} 
.bginput, select { 
color:#000000; 
vertical-align:middle; 
padding:2px; 
border:1px solid #BAC0C3; 
background:#F9FBFD; 
} 
.button { 
vertical-align:middle; 
padding:1px 3px 0px 3px; 
background:#F3F4F5; 
border:1px solid #B7C0C7; 
margin:0px; 
width:180px; 
} 
div { 
width:100%; 
} 
</style> 
</head> <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><td valign="top" align =center> 
<form name="form1" method="post" action=""> 
<h1>Base64在线编码解码 gb2312 <a href="?down=1">源码下载</a></h1> 
<p> 
请输入转换的地址: 
<textarea name="text1" rows="14" class="bginput" style="width:520px;"><?php echo htmlspecialchars($txt1,ENT_QUOTES);?></textarea> 
<br> 
请选择转换的方式: 
<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"); 
?> 
</textarea> 
<br> 
</p> 
<input type="submit" name="button" class="button" value="编码" /> 
<input type="submit" name="button" class="button" value="解码" /><br> 
</form> 
</td></tr> 
<tr><td height="10"></td></tr><tr><td height="20" bgcolor="#CCCCCC" align=center></td> 
</tr> 
</table> 
</body> 
</html>
PHP 相关文章推荐
PHP中文汉字验证码
Apr 08 PHP
php 中的4种标记风格介绍
May 10 PHP
php缩小png图片不损失透明色的解决方法
Dec 25 PHP
PHP四舍五入精确小数位及取整
Jan 14 PHP
免费的ip数据库淘宝IP地址库简介和PHP调用实例
Apr 08 PHP
php中mysql连接和基本操作代码(快速测试使用,简单方便)
Apr 25 PHP
php实现的日历程序
Jun 18 PHP
php版微信支付api.mch.weixin.qq.com域名解析慢原因与解决方法
Oct 12 PHP
php基于websocket搭建简易聊天室实践
Oct 24 PHP
利用PHP获取访客IP、地区位置、浏览器及来源页面等信息
Jun 27 PHP
PHP simplexml_import_dom()函数讲解
Feb 03 PHP
YII2框架中behavior行为的理解与使用方法示例
Mar 13 PHP
DEDE采集大师官方留后门的删除办法
Jan 08 #PHP
php !function_exists(&quot;T7FC56270E7A70FA81A5935B72EACBE29&quot;))代码解密
Jan 07 #PHP
PHP备份/还原MySQL数据库的代码
Jan 06 #PHP
php循环检测目录是否存在并创建(循环创建目录)
Jan 06 #PHP
全局记录程序片段的运行时间 正确找到程序逻辑耗时多的断点
Jan 06 #PHP
Discuz Uchome ajaxpost小技巧
Jan 04 #PHP
php INI配置文件的解析实现分析
Jan 04 #PHP
You might like
ThinkPHP惯例配置文件详解
2014/07/14 PHP
php技术实现加载字体并保存成图片
2015/07/27 PHP
golang 调用 php7详解及实例
2017/01/04 PHP
PHP删除数组中指定值的元素常用方法实例分析【4种方法】
2018/08/21 PHP
手机Web APP如何实现分享多平台功能
2016/08/19 Javascript
浅谈js中function的参数默认值
2017/02/20 Javascript
JavaScript用二分法查找数据的实例代码
2017/06/17 Javascript
深入理解vue2.0路由如何配置问题
2017/07/18 Javascript
基于js 字符串indexof与search方法的区别(详解)
2017/12/04 Javascript
jQuery中库的引用方法
2018/01/06 jQuery
实例详解vue.js浅度监听和深度监听及watch用法
2018/08/16 Javascript
基于AngularJs select绑定数字类型的问题
2018/10/08 Javascript
在移动端使用vue-router和keep-alive的方法示例
2018/12/02 Javascript
JS实现iframe中子父页面跨域通讯的方法分析
2020/03/10 Javascript
centos 安装python3.6环境并配置虚拟环境的详细教程
2018/02/22 Python
python 实现视频流下载保存MP4的方法
2019/01/09 Python
python 调用钉钉机器人的方法
2019/02/20 Python
linux中如何使用python3获取ip地址
2019/07/15 Python
python爬虫增加访问量的方法
2019/08/22 Python
python paramiko远程服务器终端操作过程解析
2019/12/14 Python
Pytorch 实现权重初始化
2019/12/31 Python
Python pip配置国内源的方法
2020/02/14 Python
python3中TQDM库安装及使用详解
2020/11/18 Python
Python绘制词云图之可视化神器pyecharts的方法
2021/02/23 Python
CSS3 RGBA色彩模式使用实例讲解
2016/04/26 HTML / CSS
Moda Italia荷兰:意大利男士服装
2019/08/31 全球购物
个人找工作自荐信格式
2013/09/21 职场文书
学生打架检讨书1000字
2014/01/16 职场文书
我的中国梦演讲稿600字
2014/08/19 职场文书
离婚协议书该怎么写
2014/10/04 职场文书
2015年安全教育月活动总结
2015/03/26 职场文书
文明礼仪倡议书
2015/04/28 职场文书
家长对学校的意见和建议
2015/06/03 职场文书
导游词之台湾阿里山
2019/10/23 职场文书
springboot应用服务启动事件的监听实现
2022/04/06 Java/Android
详解Nginx的超时keeplive_timeout配置步骤
2022/05/25 Servers