note 118244 added to function.base64-decode
| From: | walf | Date: | Mon, 02 Nov 2015 06:58:53 +0000 |
| Subject: | note 118244 added to function.base64-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204069@lists.php.net to get a copy of this message | ||
Base64 for URL parameters/filenames, that adhere to RFC 4648.
Defaults to dropping the padding on encode since it's not required for decoding, and keeps the
URL free of % encodings.
<?php
function base64url_encode($data, $pad = null) {
$data = str_replace(array('+', '/'), array('-', '_'),
base64_encode($data));
if (!$pad) {
$data = rtrim($data, '=');
}
return $data;
}
function base64url_decode($data) {
return base64_decode(str_replace(array('-', '_'), array('+',
'/'), $data));
}
----
Server IP: 103.11.79.64
Probable Submitter: 150.101.23.241
----
Manual Page -- http://php.net/manual/en/function.base64-decode.php
Edit -- https://master.php.net/note/edit/118244
Del: integrated -- https://master.php.net/note/delete/118244/integrated
Del: useless -- https://master.php.net/note/delete/118244/useless
Del: bad code -- https://master.php.net/note/delete/118244/bad+code
Del: spam -- https://master.php.net/note/delete/118244/spam
Del: non-english -- https://master.php.net/note/delete/118244/non-english
Del: in docs -- https://master.php.net/note/delete/118244/in+docs
Del: other reasons-- https://master.php.net/note/delete/118244
Reject -- https://master.php.net/note/reject/118244
Search -- https://master.php.net/manage/user-notes.php