实例
编码字符串:
<?php
$str = "hello world!";
echo convert_uuencode($str);
?>
定义和用法
convert_uuencode() 函数使用 uuencode 算法对字符串进行编码。
注释:该函数把所有字符串(包括二进制)编码为可打印的字符,确保其数据库存储及网络传输的安全。请记住,在重新使用数据前,请使用 convert_uudecode() 函数。
注释:uuencoded 数据比原数据大约增大 35%。
语法
convert_uuencode(string)
参数 描述
string 必需。规定要进行 uuencode 编码的字符串。
技术细节
返回值: 返回 uuencoded 编码的数据。
php 版本: 5+
更多实例
实例 1
编码字符串,然后对它进行解码:
<?php
$str = "hello world!";
// encode the string
$encodestring = convert_uuencode($str);
echo $encodestring . "<br>";
// decode the string
$decodestring = convert_uudecode($encodestring);
echo $decodestring;
?>
语法:convert_uuencode(string),代码如下:
$str="hello world"; //定义字符串
echo $str; //输出原始字符串
$result=convert_uuencode($str); //执行uuencode操作
echo $result;
以上就是php使用uuencode算法对字符串进行编码的函数convert_uuencode()的详细内容。