Online Demo address:
Gb2312 version http://tools.jb51.net/tools/base64_decode-gb2312.php
Utf8 edition http://tools.jb51.net/tools/base64_decode-utf8.php
Copy codeThe Code is as follows: <? Php
Header ('content-Type: text/html; charset = gb2312 ');
$ Txt1 = stripslashes (trim (@ $ _ POST ['text1']);
$ Button = @ $ _ POST ['click'];
$ Down = @ trim ($ _ GET ['low']);
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 online encoding and decoding" name = "keywords">
<Title> Base64 online encoding and decoding gb2312 </title>
<Style>
P {
FONT-SIZE: 9pt;
Line-height: 150%;
Width: 50%;
BORDER: # DDDDDD 1px solid;
Padding: 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> <td valign = "top" align = center>
<Form name = "form1" method = "post" action = "">
<H1> Base64 online encoding and decoding gb2312 <a href = "? Down = 1 "> source code download </a> <P>
Enter the conversion address:
<Textarea name = "text1" rows = "14" class = "bginput" style = "width: 520px;"> <? Php echo htmlspecialchars ($ txt1, ENT_QUOTES);?> </Textarea>
<Br>
Select the conversion method:
<Textarea rows = "14" class = "bginput" style = "width: 520px;"> <? Php
If ($ button = "encoding") echo base64_encode ($ txt1 );
If ($ button = "decoding") echo mb_convert_encoding (base64_decode ($ txt1), "gb2312", "UTF-8 ");
?>
</Textarea>
<Br>
</P>
<Input type = "submit" name = "button" class = "button" value = "encoding"/>
<Input type = "submit" name = "button" class = "button" value = "decoding"/> <br>
</Form>
</Td> </tr>
<Tr> <td height = "10"> </td> </tr> <td height = "20" bgcolor = "# cccccccc" align = center> </td>
</Tr>
</Table>
</Body>
</Html>