- 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://code.google.com/p/rfphp4zf");?
堅持為客戶提供有價值的服務(wù)和內(nèi)容