假设您想反转操作,这是一种“ldap_unescape”的方法
<?php
function ldap_unescape($string) {
return
preg_replace_callback(
"/\\\\[\da-z]{2}/",
function ($matches) {
$match = array_shift($matches);
return hex2bin(substr($match, 1));
},
$string
);
}
$result = ldap_unescape("uid=\\61\\6c\\70\\68\\6f\\6e\\7a\\6f,ou=people,dc=foo,dc=com"); // uid=alphonzo,ou=people,dc=foo,dc=com
?>