PHP Base64_decode and base64_encode_php Tutorials

Source: Internet
Author: User
PHP Base64_decode and Base64_encode

Base64_decode
(PHP 4, PHP 5)

Base64_decode-BASE64 encoded mime of decoded data

Describe
String Base64_decode (String $ data [, Boolean $ strict = false])
Decodes a BASE64 encoded data.

Parameters

Data
Encoded data.

Strict
Returns False if the input contains a Base64 alphabet other than the character.


return value
Failed to return raw data or false. The returned data may be binary.

Modify

Release Notes
5.2.0 a strict supplement


Instance

Example # 1 Base64_decode () example

$str = ' vghpcybpcybhbiblbmnvzgvkihn0cmluzw== ';
echo Base64_decode ($STR);
?>
The above example would output:

This is an encoded string

Base64_encode
(PHP 4, PHP 5)

Base64_encode-Base64 with MIME-encoded data

Describe
String Base64_encode (string $ data)
Encode specific data for Base64.

This encoding is intended to enable binary data to survive transport through the transport layer and does not support 8-bit encoding, such as an e-mail organization.

The data that is BASE64 encoded takes approximately 33 more space than the original data.

Parameters

Data
This data is encoded.


return value
Encodes the data as a string.

Instance

Example # 1 Base64_encode () example

$str = ' This was an encoded string ';
echo Base64_encode ($STR);
?>
The above example would output:

vghpcybpcybhbiblbmnvzgvkihn0cmluzw==


http://www.bkjia.com/PHPjc/445458.html www.bkjia.com true http://www.bkjia.com/PHPjc/445458.html techarticle php Base64_decode with Base64_encode base64_decode (PHP 4, PHP 5) Base64_decode-the MIME description string that decodes the BASE64 encoding of the data Base64_decode (String $ data [, cloth ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.