利用Python生成随机域名等随机字符串. #!/usr/bin/env python# -*- coding: utf-8 -*- from random import randrange, choice from string import ascii_lowercase as lc from sys import maxsize from time import ctime tlds = ('com', 'edu', 'net', 'org', 'gov') for i in range(…
var convertStr = encodeURIComponent(urlStr); //转换的原链接可能存在"&"这样的特殊符号,导致原链接的某些字段会被当做ajax请求的参数,所以最好先进行转码 getShortUrl(convertStr); function getShortUrl(urlStr){ $.ajax({ type : 'GET', url : 'http://api.t.sina.com.cn/short_url/shorten.json?source…