encode64 can obtain the shortest encoded data consisting of 26 English uppercase and lowercase letters and numbers plus the two symbols "-_". This string can be transmitted freely on the network without considering the confusion caused by automatic transcoding. Disadvantages : It is too slow for large strings. The reason is unknown. Maybe the PHP script itself is slow, so it has many built-in functions. If these functions are implemented in scripts, it would be intolerable. JavaScript does not have this problem, and scripts are much faster.
The first step is to download the encode64 encoding library of PHP we need: //m.sbmmt.com/xiazai/leiku/806
The second step, after the download is completed, find the php class file we need, decompress it to the local directory, and create a new php file~
The third step, in the new file, we need to call this Class, and instantiate this class:
<?php include_once "code64.php"; //引入类文件 $obj = new Encode64; //实例化此类 $str = " //定义变量 echo $obj->code($str); //输出 ?>
Run this file, and the result will be as shown below:
Note:
In this example, we only used one of the classes as an explanation. Friends can try the rest of the examples themselves!
The above is the detailed content of PHP analysis on the use of encode64 encoding. For more information, please follow other related articles on the PHP Chinese website!