1

PHP 的过来 帮看看

 1 year ago
source link: https://www.v2ex.com/t/885473
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  PHP

PHP 的过来 帮看看

  xx3122 · 5 小时 18 分钟前 · 996 次点击

function code62($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 shorturl($url) {
$url = crc32 ( $url );
$result = sprintf ( "%u", $url );
return code62($result);
}
直接 echo shorturl("https://baidu.com"); = dXr5x1
这是某个短网址的缩短方法

请问有解析的方法不,比如根据 dXr5x1 解出 https://baidu.com ,而不是去数据库查找。根据上面这个怎么写出一个?谢谢求 demo


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK