[Php 4, Php 5, Php 7, Php 8]
Base64_encode - Mã hóa dữ liệu với MIME Base64 — Encodes data with MIME base64
Sự mô tả
base64_encode [Chuỗi $string
]: Chuỗi[string $string
]: string
Mã hóa này được thiết kế để làm cho dữ liệu nhị phân tồn tại vận chuyển thông qua các lớp vận chuyển không sạch 8 bit, chẳng hạn như các thân thư.
Dữ liệu được mã hóa Base64 mất khoảng 33% so với dữ liệu gốc.
Thông số
string
Dữ liệu để mã hóa.
Trả về giá trị
Dữ liệu được mã hóa, như một chuỗi.
Ví dụ
Ví dụ #1 base64_encode [] Ví dụbase64_encode[] example
Ví dụ trên sẽ xuất ra:
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==
Xem thêm
- base64_decode [] - Giải mã dữ liệu được mã hóa bằng mime base64
- Chunk_split [] - Chia một chuỗi thành các khối nhỏ hơn
- convert_uuencode [] - uuencode một chuỗi
- »& NBSP; RFC 2045 Phần 6.8
Gutzmer tại USA DOT NET ¶
11 năm trước
For anyone interested in the 'base64url' variant encoding, you can use this pair of functions:
Rasmus Schultz ¶ ¶
4 năm trước
In PHP 7, the padding issue with base64_decode[] is no more - the following is totally fine:
function base64_encode_url[$string] {
return str_replace[['+','/','='], ['-','_',''], base64_encode[$string]];
}
$string
0
$string
1
$string
2
$string
3Biziclop tại Vipmail Dot Hu ¶
5 năm trước
$string
4
$string
5
$string
6
$string
7Mitmacher ¶ ¶
13 năm trước
$string
8
$string
9
string
0
string
1
string
2Hayley Watson ¶ ¶
9 năm trước
string
3
string
4
string
5
string
6
$string
3Luke tại lukeoliff.com ¶
11 năm trước
string
8
string
9
0
1
2
3
$string
3Rasmus Schultz ¶ ¶
4 năm trước
5
6
7
$string
3Biziclop tại Vipmail Dot Hu ¶
5 năm trước
9
Mitmacher ¶ ¶
13 năm trước
For anyone interested in the 'base64url' variant encoding, you can use this pair of functions:
0
For anyone interested in the 'base64url' variant encoding, you can use this pair of functions:
1
$string
3Hayley Watson ¶ ¶
9 năm trước
For anyone interested in the 'base64url' variant encoding, you can use this pair of functions:
3
For anyone interested in the 'base64url' variant encoding, you can use this pair of functions:
4
$string
6
For anyone interested in the 'base64url' variant encoding, you can use this pair of functions:
6Luke tại lukeoliff.com ¶
Massimo Dot Scamarcia tại Gmail Dot Com ¶
For anyone interested in the 'base64url' variant encoding, you can use this pair of functions:
7
For anyone interested in the 'base64url' variant encoding, you can use this pair of functions:
8
For anyone interested in the 'base64url' variant encoding, you can use this pair of functions:
9
0base64url_decode[$data] {
1
return base64_decode[str_pad[strtr[$data, '-_', '+/'], strlen[$data] % 4, '=', STR_PAD_RIGHT]];
}
?>
$string
3Rasmus Schultz ¶ ¶
4 năm trước
base64url_decode[$data] {
3
return base64_decode[str_pad[strtr[$data, '-_', '+/'], strlen[$data] % 4, '=', STR_PAD_RIGHT]];
}
?>
base64url_decode[$data] {
4
return base64_decode[str_pad[strtr[$data, '-_', '+/'], strlen[$data] % 4, '=', STR_PAD_RIGHT]];
}
?>
$string
3Biziclop tại Vipmail Dot Hu ¶
13 năm trước
base64url_decode[$data] {
6
return base64_decode[str_pad[strtr[$data, '-_', '+/'], strlen[$data] % 4, '=', STR_PAD_RIGHT]];
}
?>
base64url_decode[$data] {
7
return base64_decode[str_pad[strtr[$data, '-_', '+/'], strlen[$data] % 4, '=', STR_PAD_RIGHT]];
}
?>
$string
3Rasmus Schultz ¶ ¶
4 năm trước
base64url_decode[$data] {
9
return base64_decode[str_pad[strtr[$data, '-_', '+/'], strlen[$data] % 4, '=', STR_PAD_RIGHT]];
}
?>
In PHP 7, the padding issue with base64_decode[] is no more - the following is totally fine:
0
$string
3Biziclop tại Vipmail Dot Hu ¶
5 năm trước
In PHP 7, the padding issue with base64_decode[] is no more - the following is totally fine:
2
In PHP 7, the padding issue with base64_decode[] is no more - the following is totally fine:
3
In PHP 7, the padding issue with base64_decode[] is no more - the following is totally fine:
4
In PHP 7, the padding issue with base64_decode[] is no more - the following is totally fine:
5
$string
3Mitmacher ¶ ¶
4 năm trước
In PHP 7, the padding issue with base64_decode[] is no more - the following is totally fine:
7
Biziclop tại Vipmail Dot Hu ¶
5 năm trước
In PHP 7, the padding issue with base64_decode[] is no more - the following is totally fine:
8
In PHP 7, the padding issue with base64_decode[] is no more - the following is totally fine:
9
function base64_encode_url[$string] {
0
return str_replace[['+','/','='], ['-','_',''], base64_encode[$string]];
}
function base64_encode_url[$string] {
1
return str_replace[['+','/','='], ['-','_',''], base64_encode[$string]];
}
function base64_encode_url[$string] {
2
return str_replace[['+','/','='], ['-','_',''], base64_encode[$string]];
}
function base64_encode_url[$string] {
3
return str_replace[['+','/','='], ['-','_',''], base64_encode[$string]];
}
function base64_encode_url[$string] {
4
return str_replace[['+','/','='], ['-','_',''], base64_encode[$string]];
}
function base64_encode_url[$string] {
5
return str_replace[['+','/','='], ['-','_',''], base64_encode[$string]];
}
function base64_encode_url[$string] {
6
return str_replace[['+','/','='], ['-','_',''], base64_encode[$string]];
}
function base64_encode_url[$string] {
7
return str_replace[['+','/','='], ['-','_',''], base64_encode[$string]];
}
function base64_encode_url[$string] {
8
return str_replace[['+','/','='], ['-','_',''], base64_encode[$string]];
}
function base64_encode_url[$string] {
9
return str_replace[['+','/','='], ['-','_',''], base64_encode[$string]];
}
$string
00
$string
01
$string
02
$string
3Mitmacher ¶ ¶
13 năm trước
$string
04
$string
05
$string
06
$string
07Hayley Watson ¶ ¶
4 năm trước
$string
08
$string
09
$string
10
$string
11
$string
12
$string
3Biziclop tại Vipmail Dot Hu ¶
13 năm trước
$string
14
Hayley Watson ¶ ¶
9 năm trước
$string
15
$string
16
$string
17Luke tại lukeoliff.com ¶
5 năm trước
$string
18
$string
19
$string
6
$string
21Mitmacher ¶ ¶
4 năm trước
$string
22
$string
23
$string
3Biziclop tại Vipmail Dot Hu ¶
5 năm trước
$string
25
$string
26