Home > Backend Development > PHP Tutorial > How to determine whether a string is base64 encoded in PHP

How to determine whether a string is base64 encoded in PHP

小云云
Release: 2023-03-20 18:02:01
Original
5565 people have browsed it

This article mainly shares with you how to use PHP to determine whether a string is base64 encoded. I hope it can help you.

/**
 * 判断字符串是否base64编码
 */
function func_is_base64($str)
{  
    return $str == base64_encode(base64_decode($str)) ? true : false;  
}
Copy after login

Related recommendations:

How to use base64 encoding for html pictures instead

Javascript converts the absolute path of the picture to base64 encoding

php Secure URL string base64 encoding and decoding example code

The above is the detailed content of How to determine whether a string is base64 encoded in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template