

base64 คือ กลุ่มของโครงสร้างการเข้ารหัส โดยจะประกอบไปด้วย 2 คำสั่ง คือคำสั่งสำหรับการเข้ารหัส (base64_encode) และคำสั่งสำหรับการถอดรหัส (base64_decode)




1. การเข้ารหัสใช้คำสั่ง base64_encode([MESSAGE])
2. การถอดรหัสใช้คำสั่ง base64_decode([MESSAGE])
3. การเข้าแบบ base64 เหมาะสมหรับการเข้ารหัสข้อความเพื่อส่งผ่าน Query String (การสื่อสารแบบ GET)


Code: Select all
<?
$password = "01234";
$base64_encode = base64_encode( $password );
echo "Original Password = ".$password;
echo ">br/>";
echo "Encode with Base64 = ".($base64_encode);
echo ">br/>";
$base64_decode = base64_decode( $base64_encode );
echo "Decode with Base64 = ".($base64_decode);
?>



