如何在PHP中将Base64字符串解码为文本?
需要将Base64编码字符串(\x代码)转换为正常可读文本 例如:如何在PHP中将Base64字符串解码为文本?,php,Php,需要将Base64编码字符串(\x代码)转换为正常可读文本 例如: Convert "\x62\141\x73\145\x36\64\x5f\144\x65\143\x6f\144\x65" to "base64_decode". 如何使用PHP实现这一点。谢谢。如何将x代码转换为文本: $xCodes = '\x62\x61\x73\x65\x36\x34\x5f\x64\x65\x63\x6f\x64\x65'; $result = preg_replace_callback("/(\\\
Convert "\x62\141\x73\145\x36\64\x5f\144\x65\143\x6f\144\x65"
to "base64_decode".
如何使用PHP实现这一点。谢谢。如何将x代码转换为文本:
$xCodes = '\x62\x61\x73\x65\x36\x34\x5f\x64\x65\x63\x6f\x64\x65';
$result = preg_replace_callback("/(\\\\x)([0-9A-Fa-f]+)/u", function($matched) {
return chr(hexdec($matched[2]));
}, $xCodes);
var_dump($result); // string(13) "base64_decode"