Who can give an example of base62 decoding ?? I can see an example about URL encoding on the Internet, but there is no decoding example. who can give it a decoding example ?? Example code for encoding: & lt ;? Phpfunction & nbsp; base62 ($ x) {$ show & nbsp ;=& nbsp; ''; who can give an example of base62 decoding with wh ??
I can see an example about URL encoding on the Internet, but there is no decoding example. who can give it a decoding example ??
Example code for encoding:
function base62($x){
$show = '';
while($x > 0){
$s = $x % 62;
if ($s > 35) {
$s = chr($s+61);
} elseif ($s > 9 && $s<=35) {
$s = chr($s + 55);
}
$show .= $s;
$x = floor($x/62);
}
return $show;
}
function urlShort($url)
{
$url = crc32($url);
$result = sprintf("%u", $url);
return base62($result);
}
echo urlShort("http://www.baidu.com");
?>
Php url function
------ Solution --------------------
This is impossible!
Your urlShort function only takes the checksum (CRC32) of the incoming data, so it is irreversible.
------ Solution --------------------
301 jump
------ Solution --------------------
Reference:
Reference: this is impossible!
Your urlShort function only takes the checksum (CRC32) of the incoming data, so it is irreversible.
In the past, how are short URLs implemented?
Convert a domain name into a short domain name using a certain algorithm before receiving the database
Get the original domain name based on the short domain name query form and then jump