Home >Backend Development >PHP Tutorial >PHP analysis on the use of encode64 encoding

PHP analysis on the use of encode64 encoding

黄舟
黄舟Original
2017-08-16 09:33:502125browse

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: http://www.php.cn/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:

PHP analysis on the use of encode64 encoding

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn