function drupal_base64_encode

Returns a URL-safe, base64 encoded version of the supplied string.

Parameters

$string: The string to convert to base64.

Return value

string

1 call to drupal_base64_encode()
drupal_random_key in includes/bootstrap.inc
Returns a URL-safe, base64 encoded string of highly randomized bytes (over the full 8-bit range).

File

includes/bootstrap.inc, line 2300

Code

function drupal_base64_encode($string) {
    $data = base64_encode($string);
    // Modify the output so it's safe to use in URLs.
    return strtr($data, array(
        '+' => '-',
        '/' => '_',
        '=' => '',
    ));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.