This article mainly introduces the PHP base64 encoding and decoding instance code of the relevant information, the need for friends can refer to the following
PHP base64 encoding and decoding detailed
1. Custom rule mode encoding and decoding
Instance
Public Function Test_changinttostr () { $intvalue 1 = 1232344234; $intStr = "; $str = "Y 9 L f k g y 5 R o v i x i 1 a o F 8 U H D s 3 R 4 D M p L q Z J x p q E b E 0 W s J B N 7 W v Z M n 2 G C 6 T H C A K u T "; $seq = Explode ("", $str); $intvalue = $intvalue 1; while ($intvalue >=) { # code ... $INTSTR = ($seq [$intvalue%]). $intStr; $intvalue = (int) ($intvalue/62); } $INTSTR = ($seq [$intvalue]). $intStr; Echo ($INTSTR); $keySeq = Array_flip ($SEQ); $length = strlen ($INTSTR); $value = 0; for ($i = $length-1; $i >=0; $i-) { $t = $keySeq [$INTSTR [$i]]; $s = ($length-$i)-1; $m = (POW ($s) * $t); $value + = $m; } echo $value; }
2. Using System functions to complete the encoding and decoding of base64 bits
Instance code:
Public Function Testarray () {// $str [' a '] = ' sdfsdf ';// $str [' d '] = ' sdafsdf ';// $NEWSTR = $this Modifyarray ($STR); $value = Gmp_strval (Gmp_init (' 234234234234 ', ten), +); $newValue = Gmp_strval (Gmp_init ($value, ()); }
The above is the whole content of this article, I hope that everyone's study has helped.