Copy CodeThe code is as follows:
function unescape ($STR)
{
$ret = ";
$len = strlen ($STR);
for ($i = 0; $i < $len; $i + +)
{
if ($str [$i] = = '% ' && $str [$i +1] = = ' U ')
{
$val = Hexdec (substr ($str, $i +2, 4));
if ($val < 0x7f) $ret. = Chr ($val);
else if ($val < 0x800) $ret. = Chr (0xc0| ( $val >>6). Chr (0x80| ( $val &0x3f));
else $ret. = Chr (0xe0| ( $val >>12). Chr (0x80| ( ($val >>6) &0x3f). Chr (0x80| ( $val &0x3f));
$i + = 5;
}
else if ($str [$i] = = '% ')
{
$ret. = UrlDecode (substr ($str, $i, 3));
$i + = 2;
}
else $ret. = $str [$i];
}
return $ret;
}
http://www.bkjia.com/PHPjc/326198.html www.bkjia.com true http://www.bkjia.com/PHPjc/326198.html techarticle Copy the code as follows: function unescape ($str) {$ret = "; $len = strlen ($STR); for ($i = 0; $i $len; $i + +) {if ($str [$i] = = '% ') $STR [$i +1] = = ' U ') {$val = Hexdec (substr ($st ...