首頁  >  文章  >  後端開發  >  php使用uuencode演算法對字串進行編碼的函數convert_uuencode()

php使用uuencode演算法對字串進行編碼的函數convert_uuencode()

黄舟
黄舟原創
2017-11-02 10:16:051344瀏覽

實例

編碼字串:

<?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()的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn