Need to convert a Base64 encoded string (\\x codes) to normal readable text.
For example:
Convert "\x62\141\x73\145\x36\64\x5f\144\x65\143\x6f\144\x65"
to "base64_decode".
How to do this with PHP. Thanks.
How to convert x-codes to text:
$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"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.