Encode
$str =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
例如
testpq1-1-abc.com/80/test/test.htm?redirect.asp%uhttp://abc.com
Encode後就是
testpq1%2D1%2Dabc%2Ecom%2F80%2Ftest%2Ftest%2Ehtm%3Fredirect%2Easp%25uhttp%3A%2F%2Fabc%2Ecom
Decode
$str =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg;
參考一下吧~~~^^
星期三, 7月 09, 2008
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言