PhpescapeURL encoding. The code for copying the escapeunescape function of Xu Zening's php version is as follows: functionescape ($ str) {preg_match_all ([x80-xff]. | [x01-x7f] +, $ str, $ r); $ ar $ r [0]; foreach ($ aras $ k $ Xu zouning's php version of the escape/unescape function
The code is as follows:
Function escape ($ str ){
Preg_match_all ("/[\ x80-\ xff]. | [\ x01-\ x7f] +/", $ str, $ r );
$ Ar = $ r [0];
Foreach ($ ar as $ k => $ v ){
If (ord ($ v [0]) <128)
$ Ar [$ k] = rawurlencode ($ v );
Else
$ Ar [$ k] = "% u". bin2hex (iconv ("GB2312", "UCS-2", $ v ));
}
Return join ("", $ ar );
}
Function unescape ($ str ){
$ Str = rawurldecode ($ str );
Preg_match_all ("/(? : % U. {4}) |. +/", $ str, $ r );
$ Ar = $ r [0];
Foreach ($ ar as $ k => $ v ){
If (substr ($ v, 0, 2) = "% u" & strlen ($ v) = 6)
$ Ar [$ k] = iconv ("UCS-2", "GB2312", pack ("H4", substr ($ v,-4 )));
}
Return join ("", $ ar );
}
The signature code is as follows: function escape ($ str) {preg_match_all ("/[\ x80-\ xff]. | [\ x01-\ x7f] +/", $ str, $ r); $ ar = $ r [0]; foreach ($ ar as $ k = $...