(PHP 4, PHP 5, PHP 7, PHP 8)
base64_decode — 對使用 MIME base64 編碼的數(shù)據(jù)進行解碼
$data, bool $strict = false): string
對 base64 編碼的 data 進行解碼。
data編碼過的數(shù)據(jù)。
strict
當設置 strict 為 true 時,一旦輸入的數(shù)據(jù)超出了 base64 字母表,將返回 false。
否則會靜默丟棄無效的字符。
返回原始數(shù)據(jù), 或者在失敗時返回 false。返回的數(shù)據(jù)可能是二進制的。
| 版本 | 說明 |
|---|---|
| 5.2.0 | 增加了 strict 。 |
示例 #1 base64_decode() 示例
<?php
$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo base64_decode($str);
?>
以上例程會輸出:
This is an encoded string