Php simulates the function code of the js function unescape. Copy the code as follows: functionunescape scape ($ str) {$ ret; $ lenstrlen ($ str); for ($ i0; $ I $ len; $ I ++) {if ($ str [$ I] % $ str [$ I + 1] u) {$ valhexdec (substr ($ st
The 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;
}
The http://www.bkjia.com/PHPjc/326198.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/326198.htmlTechArticle 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 ($ st...