JWT::urlsafeB64Encode PHP 메소드

urlsafeB64Encode() 공개 정적인 메소드

Encode a string with URL-safe Base64.
public static urlsafeB64Encode ( string $input ) : string
$input string The string you want encoded
리턴 string The base64 encode of what you passed in
    public static function urlsafeB64Encode($input)
    {
        return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
    }

Usage Example

예제 #1
0
파일: JWT.php 프로젝트: aodkrisda/phprest
 public static function encode($payload, $key, $algo = 'HS256')
 {
     $header = array('typ' => 'JWT', 'alg' => $algo);
     $segments = array(JWT::urlsafeB64Encode(json_encode($header)), JWT::urlsafeB64Encode(json_encode($payload)));
     $signing_input = implode('.', $segments);
     $signature = JWT::sign($signing_input, $key, $algo);
     $segments[] = JWT::urlsafeB64Encode($signature);
     return implode('.', $segments);
 }
All Usage Examples Of JWT::urlsafeB64Encode