convert_uuencode

(PHP 5, PHP 7, PHP 8)

convert_uuencode使用 uuencode 编码一个字符串

说明

convert_uuencode ( string $data ) : string

convert_uuencode() 使用 uuencode 算法对一个字符串进行编码。

uuencode 算法会将所有(含二进制数据)字符串转化为可输出的字符, 并且可以被安全的应用于网络传输。使用 uuencode 编码后的数据 将会比源数据大35%左右

参数

data

需要被编码的数据。

返回值

返回 uuencode 编码后的数据 或者在失败时返回 false

范例

Example #1 convert_uuencode() 例子

<?php
$some_string 
"test\ntext text\r\n";

echo 
convert_uuencode($some_string);
?>

参见

User Contributed Notes

zash at zash dot se 30-May-2008 12:30
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.
root at mantoru dot de 10-Nov-2007 09:29
@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
PHP8中文手册 站长在线 整理 版权归PHP文档组所有