php base64_decode 與base64_encode

來源:互聯網
上載者:User

base64_decode
( PHP 4中, PHP 5中)

base64_decode -解碼資料的Base64編碼的MIME

描述
字串base64_decode (字串$資料[ ,布爾$嚴格=虛假] )
解碼一BASE64編碼資料。

參數

資料
編碼資料。

嚴格
返回FALSE如果輸入包含字元以外的一個base64字母表。


傳回值
返回未經處理資料或FALSE的失敗。返回的資料可能是二進位。

修改

版本說明
5.2.0嚴格的補充


執行個體

例如# 1 base64_decode ( )的例子

<?php
$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo base64_decode($str);
?>
The above example will output:

This is an encoded string

base64_encode
( PHP 4中, PHP 5中)

base64_encode -使用MIME編碼的資料進行Base64

描述
字串base64_encode (字串$資料)
編碼特定資料進行Base64 。

這種編碼是為了使位元據生存運輸通過運輸層不支援8 - bit編碼,如電子郵件機構。

進行Base64編碼的資料大約需要33 %以上的空間比未經處理資料。

參數

資料
這些資料進行編碼。


傳回值
編碼資料,作為一個字串。

執行個體

例如# 1 base64_encode ( )的例子

<?php
$str = 'This is an encoded string';
echo base64_encode($str);
?>
The above example will output:

VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.