函式:imap_base64()
適用版本:PHP 4, PHP 5, PHP 7
用法:imap_base64() 函式將 Base64 編碼的字串解碼為原始資料。
語法:string imap_base64 ( string $text )
引數:
- text:需要解碼的 Base64 編碼的字串。
返回值:
- 返回解碼後的原始資料,如果解碼失敗則返回 FALSE。
示例:
// Base64 編碼的字串
$base64String = "SGVsbG8gV29ybGQ=";
// 解碼 Base64 字串
$decodedString = imap_base64($base64String);
// 輸出解碼後的原始資料
echo $decodedString;
輸出:
Hello World
注意事項:
- 如果傳遞給 imap_base64() 函式的引數不是合法的 Base64 編碼字串,函式將返回 FALSE。
- 在 PHP 7.2.0 之後的版本中,imap_base64() 函式已被廢棄,建議使用 base64_decode() 函式代替。