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 | |
// | |
// Set proper header to make Unicode filename works in major browsers. | |
// see http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http | |
// | |
$filename = '一个文件.txt'; | |
$ua = $_SERVER["HTTP_USER_AGENT"]; |
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 | |
class ASDF{ | |
private static $r = 10000000; | |
private static $d = 10001; | |
private static $f = 0; | |
public static function encode($x) { | |
$x %= (self::$r - self::$r % self::$d); | |
return floor(self::$r / self::$d) * (($x + self::$f) % self::$d) + floor($x / self::$d); | |
} |
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 | |
/** | |
* parse_csv | |
* parse CSV file into big array | |
* | |
* @param string $file | |
* @param string $separator | |
* @param array $meta | |
* @return array |
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
function validate_rid(id) { | |
// 18位身份证号 | |
// 国家标准《GB 11643-1999》 | |
function rid18(id) { | |
if(! /\d{17}[\dxX]/.test(id)) { | |
return false; | |
} | |
var modcmpl = function(m, i, n) { return (i + n - m % i) % i; }, | |
f = function(v, i) { return v * (Math.pow(2, i-1) % 11); }, | |
s = 0; |