base64_decode

(PHP 4, PHP 5, PHP 7, PHP 8)

base64_decode對(duì)使用 MIME base64 編碼的數(shù)據(jù)進(jìn)行解碼

說(shuō)明

base64_decode(string $data, bool $strict = false): string

對(duì) base64 編碼的 data 進(jìn)行解碼。

參數(shù)

data

編碼過(guò)的數(shù)據(jù)。

strict

當(dāng)設(shè)置 stricttrue 時(shí),一旦輸入的數(shù)據(jù)超出了 base64 字母表,將返回 false。 否則會(huì)靜默丟棄無(wú)效的字符。

返回值

返回原始數(shù)據(jù), 或者在失敗時(shí)返回 false。返回的數(shù)據(jù)可能是二進(jìn)制的。

更新日志

版本 說(shuō)明
5.2.0 增加了 strict

范例

示例 #1 base64_decode() 示例

<?php
$str 
'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo 
base64_decode($str);
?>

以上例程會(huì)輸出:

This is an encoded string

參見(jiàn)