- Google DNS
8.8.8.8
8.8.4.4
- OpenDNS
208.67.222.222
208.67.220.220
8.8.8.8
8.8.4.4
208.67.222.222
208.67.220.220
| <?php | |
| set_time_limit(0); | |
| $fh = fopen('list.txt','w'); | |
| if(!$fh) | |
| exit("write file error!"); | |
| $firstPage = file_get_contents("http://www.npo.org.tw/npolist_list.asp?nowpage=1&npost=&keyword2="); | |
| preg_match('/nowpage=(\d+)[^"]*">最末頁/', $firstPage, $match); | |
| $pageCount = $match[1]; |
| ''' | |
| 使用這個檔案來輔助處理 DSpace 的 api, jspui 中文語系檔的更新動作 | |
| ''' | |
| msg = {} | |
| keys = [] | |
| with open("en.txt") as enfh: | |
| for line in enfh: | |
| tmp = [i.strip() for i in line.strip().split("\t")] |
| <?php | |
| /** | |
| * 完成 阿拉伯數字 轉 中文數字 | |
| * | |
| * @author taichunmin <[email protected]> | |
| */ | |
| function chineseNumber($num) | |
| { | |
| if(empty($num)) return '零'; | |
| $num = strrev(''.intval($num)); // 轉為字串並反轉 |
| <?php | |
| /* | |
| Example: | |
| $arr = array( | |
| 'a' => '123', | |
| 'b' => '456', | |
| ); | |
| $csv = iconv('UTF-8','CP950//IGNORE',tai_array2csv($arr)); | |
| 參考: https://gist.github.com/3422591 |
| <?php | |
| /* | |
| 2012/05/15 taichunmin | |
| 用途: | |
| 計算出最大可用的檔案上傳大小。 ( 以設定檔中之 upload_max_filesize 和 post_max_size 來判定 ) | |
| 此函式是參考 phpMyAdmin 寫出 | |
| 參考: | |
| phpMyAdmin - phpMyAdmin\libraries\Config.class.php (checkUploadSize) |
| <?php | |
| // function tai_checkZHTW($str) | |
| // { | |
| // return preg_match('/(\xe2[\xba-\xbf][\x80-\xbf]|[\xe3-\xe9][\x80-\xbf]{2})/',$str); | |
| // } | |
| public function is_Han( $str ) | |
| { | |
| return preg_match("/\p{Han}+/u", $str); | |
| } | |
| ?> |
| <?php | |
| function tai_csvFixDbquotes( $csv, $delimiter = ',', $enclosure = '"' ) | |
| { | |
| $res = ''; | |
| if( $csv[ strlen($csv)-1 ] == "\r" ) | |
| $csv = substr($csv,0,-1); | |
| $inDbquotes = false; | |
| if( strlen($csv)==0 || $csv[0] != $enclosure ) | |
| $res .= $enclosure; | |
| for( $i=0; $i<strlen($csv); $i++ ) |
| <?php | |
| function tai_moneyFormat($money) | |
| { | |
| $res = ''; | |
| $money = ''.$money; | |
| for( $i=strlen($money)-1,$j=0; $i>=0; $i--,$j++) | |
| { | |
| $res .= $money[$i]; | |
| if($j%3==2 && $i>0) $res.=','; |