(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ố
stringDữ 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
<?php
$str = 'This is an encoded string';
echo base64_encode($str);
?>
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:
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function
base64url_decode($data) {return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
?>
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));
}
$string0
$string1
$string2
$string3Biziclop tại Vipmail Dot Hu ¶
5 năm trước
$string4
$string5
$string6
$string7Mitmacher ¶ ¶
13 năm trước
$string8
$string9
string0
string1
string2Hayley Watson ¶ ¶
9 năm trước
string3
string4
string5
string6
$string3Luke tại lukeoliff.com ¶
11 năm trước
string8
string9
<?php
$str = 'This is an encoded string';
echo base64_encode($str);
?>
0
<?php
$str = 'This is an encoded string';
echo base64_encode($str);
?>
1
<?php
$str = 'This is an encoded string';
echo base64_encode($str);
?>
2
<?php
$str = 'This is an encoded string';
echo base64_encode($str);
?>
3
Rasmus Schultz ¶ ¶
4 năm trước
<?php
$str = 'This is an encoded string';
echo base64_encode($str);
?>
5
<?php
$str = 'This is an encoded string';
echo base64_encode($str);
?>
6
<?php
$str = 'This is an encoded string';
echo base64_encode($str);
?>
7
Biziclop tại Vipmail Dot Hu ¶
5 năm trước
<?php
$str = 'This is an encoded string';
echo base64_encode($str);
?>
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
$string3Hayley 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
$string6
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
<?phpfunction base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
} 0
16 năm trước ¶
4 năm trước
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
1
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
2
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
3
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
4
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
5
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
6
Biziclop tại Vipmail Dot Hu ¶
9 năm trước
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
8
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
9
Luke tại lukeoliff.com ¶
Massimo Dot Scamarcia tại Gmail Dot Com ¶
function 1
function 2
function 3
function 4
function 5
function 6
function 7
function 8
$string316 năm trước ¶
11 năm trước
base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
?>
base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
?>
Rasmus Schultz ¶ ¶
4 năm trước
base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
?>
base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
?>
Biziclop tại Vipmail Dot Hu ¶
13 năm trước
base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
?>
base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
?>
Rasmus Schultz ¶ ¶
4 năm trước
base64url_decode($data) {
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
$string3Biziclop 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
$string3Mitmacher ¶ ¶
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) {
return str_replace(['+','/','='], ['-','_',''], base64_encode($string));
}0
function base64_encode_url($string) {
return str_replace(['+','/','='], ['-','_',''], base64_encode($string));
}1
function base64_encode_url($string) {
return str_replace(['+','/','='], ['-','_',''], base64_encode($string));
}2
function base64_encode_url($string) {
return str_replace(['+','/','='], ['-','_',''], base64_encode($string));
}3
function base64_encode_url($string) {
return str_replace(['+','/','='], ['-','_',''], base64_encode($string));
}4
function base64_encode_url($string) {
return str_replace(['+','/','='], ['-','_',''], base64_encode($string));
}5
function base64_encode_url($string) {
return str_replace(['+','/','='], ['-','_',''], base64_encode($string));
}6
function base64_encode_url($string) {
return str_replace(['+','/','='], ['-','_',''], base64_encode($string));
}7
function base64_encode_url($string) {
return str_replace(['+','/','='], ['-','_',''], base64_encode($string));
}8
function base64_encode_url($string) {
return str_replace(['+','/','='], ['-','_',''], base64_encode($string));
}9
$string00
$string01
$string02
$string3Mitmacher ¶ ¶
13 năm trước
$string04
$string05
$string06
$string07Hayley Watson ¶ ¶
4 năm trước
$string08
$string09
$string10
$string11
$string12
$string3Biziclop tại Vipmail Dot Hu ¶
13 năm trước
$string14
Hayley Watson ¶ ¶
9 năm trước
$string15
$string16
$string17Luke tại lukeoliff.com ¶
5 năm trước
$string18
$string19
$string6
$string21Mitmacher ¶ ¶
4 năm trước
$string22
$string23
$string3Biziclop tại Vipmail Dot Hu ¶
5 năm trước
$string25
$string26
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
2
$string28
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
6
$string30
$string31
$string32
$string3Mitmacher ¶ ¶
13 năm trước
$string34
$string35
$string36
$string3Hayley Watson ¶ ¶
4 năm trước
$string38
$string39
$string3Luke tại lukeoliff.com ¶
5 năm trước
$string41
$string42
$string43
$string44
function
$string46Mitmacher ¶ ¶
9 năm trước
$string47
$string48
$string6
$string50Hayley Watson ¶ ¶
4 năm trước
$string51
$string52
$string3Biziclop tại Vipmail Dot Hu ¶
13 năm trước
$string54
$string55
$string6
$string57