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; }
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!