Home  >  Article  >  Backend Development  >  What does the php base64_decode() method do?

What does the php base64_decode() method do?

青灯夜游
青灯夜游Original
2021-10-08 14:07:586451browse

In PHP, the base64_decode() method is used to decode data encoded using MIME base64 and return the original data, the syntax is "base64_decode($data,$strict)".

What does the php base64_decode() method do?

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

In php, we can use base64_encode() function to perform base64 encryption, and the base64_decode() function can decrypt.

The base64_decode() function is a built-in function in PHP that is used to decode data encoded using MIME base64.

Syntax:

base64_decode(string $data, bool $strict = false)

Decode base64 encoded data.

Parameters: This function accepts two parameters

  • data: encoded data.

  • strict: an optional parameter. When strict is set to true, once the input data exceeds the base64 alphabet, false will be returned. Otherwise invalid characters are silently discarded.

Return value: Return the original data, or return false on failure. The data returned may be binary.

Example:

<?php
$str = &#39;SGVsbG8gV29ybGQ=&#39;;
echo base64_decode($str);
?>

Output result:

What does the php base64_decode() method do?

## Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of What does the php base64_decode() method do?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn