convert_uuencode
(PHP 5, PHP 7, PHP 8)
convert_uuencode — 使用 uuencode 编码一个字符串
说明
convert_uuencode() 使用 uuencode 算法对一个字符串进行编码。
uuencode 算法会将所有(含二进制数据)字符串转化为可输出的字符,并且可以被安全的应用于网络传输。使用 uuencode 编码后的数据将会比源数据大 35% 左右。
注意: convert_uuencode() 既不生成
begin
行也不产生end
,它们是 uuencoded files 的一部分。
参数
string
-
需要被编码的数据。
返回值
返回 uuencode 编码后的数据。
更新日志
版本 | 说明 |
---|---|
8.0.0 |
在此版本之前,尝试转换空字符串将返回 false ,没有任何特殊原因。
|
示例
示例 #1 convert_uuencode() 例子
<?php
$some_string = "test\ntext text\r\n";
echo convert_uuencode($some_string);
?>
以上示例会输出:
0=&5S=`IT97AT('1E>'0-"@`` `
+添加备注
用户贡献的备注 2 notes
root at mantoru dot de ¶
17 years ago
@Craig's note: base64_encode() is better suited for that. In fact, it produces smaller output and operates slightly faster. I did a little benchmark -- here are my findings:
File: JPG, 631614 bytes
== Base64 ==
execution time: 0.0039639472961426 secs
output length: 842152
== UUencode ==
execution time: 0.004105806350708 secs
output length: 870226
zash at zash dot se ¶
16 years ago
note that using base64 or uuencode to store data in a database is pretty useless. if you properly escape your data and use a binary field (BLOB etc) there is no problem.
备份地址:http://www.lvesu.com/blog/php/function.convert-uuencode.php