Code generated for a php short URL (similar to a Weibo short URL ). Share the code generated for a php short URL. Copy the code as follows :! The DOCTYPEhtmlhtmlheadmetacharsetutf-8titleurlShorttitleheadbodyformactionurlShort.p shares the generated code for a php short URL.
The code is as follows:
UrlShort
Header ("Content-Type: text/html; charset = UTF-8 ");
Function base62 ($ x ){
$ Show = '';
While ($ x> 0 ){
$ S = $ x % 62;
If ($ s> 35 ){
$ S = chr ($ s + 61 );
} Else if ($ s> 5 & $ S <= 35 ){
$ S = chr ($ s + 55 );
} Www.jbxue.com
$ Show. = $ s;
$ X = floor ($ x/62 );
}
Return $ show;
}
// Generate a short URL
Function url_short ($ url ){
$ Url = crc32 ($ url );
$ Result = sprintf ("% u", $ url );
Return base62 ($ result );
}
Echo ("generate a short url:". url_short ($ _ POST ['URL']). "");
Bytes. The code is as follows :! DOCTYPE html lang = "en" head meta charset = "UTF-8"/titleurlShort/title/head body form action = "urlShort. p...