This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getmicrotime(){ | |
list($usec, $sec) = explode(" ",microtime()); | |
return ((float)$usec + (float)$sec); | |
} | |
//例子 | |
//开始 | |
$time_start = getmicrotime(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function shorturl($input) | |
{ | |
$base32 = array ( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5' ); | |
$hex = md5($input); | |
$hexLen = strlen($hex); | |
$subHexLen = $hexLen / 8; | |
$output = array(); | |
for ($i = 0; $i < $subHexLen; $i++) | |
{ | |
$subHex = substr ($hex, $i * 8, 8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding=utf-8 | |
def getNewId(oldid): | |
# 将输入的oldid参数拆分成元组 | |
a=[] | |
for i in oldid: | |
a.append(int(i)) | |
# 在第6和7位(从0开始计算)填入1和9,组成长度为17的元组 | |
a.insert(6,1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
/*使用imagick在动态GIF上打文字水印*/ | |
$draw = new ImagickDraw(); | |
$draw->setFont('simsun.ttc'); | |
$draw->setFontSize( 12 ); | |
$text = iconv('GB2312', 'UTF-8', '网易'); | |
$image=new Imagick(); | |
$animation = new Imagick(); |
NewerOlder