创建一个Base64编码器和解码器工具(PHP)


Creating a Base64 Coder and Decoder tool (PHP)

你好吗?我有一个网站,我有一些网站管理员工具。我有一个解码器和编码器的PHP base64。这些工具来自外部网站....我用一个框架。但并不专业。我不是一个php专业人士,但我想有一个这样的工具在我的网站上…我只需要表单代码和php代码得到uncode或base64代码。有人能帮我吗?

认为,亚历克斯

PHP内置base64。玩得开心点:)

http://php.net/manual/en/function.base64-encode.php

http://www.php.net/manual/en/function.base64-decode.php

我刚刚做了这个;而且很简单。

<?php
//this is a first-draft, untested
$encode = $_POST['encode'];
$decode = $_POST['decode'];
?>
<html>
<head>
<title>
Awesome Base64 Transcoder
</title>
</head>
<body>
<form action="" method="POST">
To encode: <input type="text" name="encode" value="<?php echo base64_decode($decode);?>">
<input type="submit" value="Encode">
</form>
<br />
<form action="" method="POST">
To decode: <input type="text" name="decode" value="<?php echo base64_encode($encode);?>">
<input type="submit" value="Decode">
</form>
</body>