Time of Update: 2016-07-25
#改變數組鍵的大小寫 $arr1=array("a"=>"Lamp","db"=>"database","LANGUAGE"=>"PHP"); print_r(array_change_key_case($arr1,CASE_UPPER)); echo ""; print_r(array_change_key_case($arr1,CASE_LOWER)); echo ""; #將一個數組分割成多個 第三個參數設定是否保留鍵 $arr2=array('a','b','c','d','e','f'
Time of Update: 2016-07-25
通過openssl實現的簽名、驗簽、非對稱加解密,需要配合x.509認證(如crt和pem)檔案使用。 /** * RSA演算法類 * 簽名及密文編碼:base64字串/十六進位字串/二進位字串流 * 填充方式: PKCS1Padding(加解密)/NOPadding(解密) * * Notice:Only accepts a single block. Block size is equal to the RSA key size! * 如密鑰長度為1024 bit,則加密時資料需小於1
Time of Update: 2016-07-25
一個php實現的簡單文法高亮顯示的函數,注意:這個函數設計的比較簡單,可能對某些文法不能高亮顯示,你可以自己擴充該函數的功能 function syntax_highlight($code){ // this matches --> "foobar" $code = preg_replace( '/"(.*?)"/U', '"$1"', $code ); // hightlight functions and
Time of Update: 2016-07-25
function remove_xss($val) { // remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are allowed // this prevents some character re-spacing such as // note that you have to handle splits with \n, \r, and \t later since they *are*
Time of Update: 2016-07-25
// Simple browser detection$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = false; if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) { $is_lynx = true;} elseif (
Time of Update: 2016-07-25
/** * “抽獎”函數 * * @param integer $first 起始編號 * @param integer $last 結束編號 * @param integer $total 獲獎人數 * * @return string **/function isWinner($first, $last, $total){ $winner = array(); for ($i=0;;$i++) { $number =
Time of Update: 2016-07-25
/** * Create a thumbnail image from $inputFileName no taller or wider than * $maxSize. Returns the new image resource or false on error. * Author: mthorn.net */ function thumbnail($inputFileName, $maxSize = 100) { $info =
Time of Update: 2016-07-25
function auth_pwgen(){ $pw = ''; $c = 'bcdfghjklmnprstvwz'; //consonants except hard to speak ones $v = 'aeiou'; //vowels $a = $c.$v; //both //use two syllables... for($i=0;$i $pw .= $c[rand(0, strlen($c)-1)
Time of Update: 2016-07-25
header("content-type:text/html;charset=gbk"); ini_set("date.timezone","Asia/chong"); //判斷檔案是否為空白 if(empty($_FILES)){ echo"上傳檔案過大"; exit; } //判斷檔案上傳是否有錯誤 if($_FILES['pic']['error']){ echo "上傳檔案"
Time of Update: 2016-07-25
金泰聯限量穩定虛擬機器主機贊助計劃 中國互連網正處於蓬勃發展的階段,又是“福士創業、萬眾創新”遇上“互連網+”這個時代最活躍元素的一年,藉助這種強大的火花,促進了整個IDC市場的趨勢健康發展。作為堅守IDC行業長期的實踐者和見證行業的發展者,此次將虛擬機器主機產品贊助模式,放棄每年的收入,以此來回報廣大使用者多年來對金泰聯的支援和厚愛,更多的是以此來堅持鼓勵新的創業者。
Time of Update: 2016-07-25
網管員的手機有妙用:一鍵報障與工單營運IT系統IT的運行維護工作對我們網管人員與營運人員來說,是我們的常規事情,但這個說平常很平常,說重要卻重要到決定一個企業的生死,非常之人總有非常之處,既要保障IT營運的日常和平,也要保證突發事件的升級。如何做到心中有底,扼制事態的危險漫延,重要是防範於未然和快速瞭解問題,能及時知道故障,隨時隨地發現問題,有一個好的工具就更非常規莫屬,我們知道對於網路管理員來說網管軟體與IT營運管理系統對IT的管理是一個很好的解決方案,但大多都不對手機移動終端應用,使得我們I
Time of Update: 2016-07-25
var $file; var $index; //建立一個檔案並寫入輸入 function null_write($new) { $f=fopen($this->file,"w"); flock($f,LOCK_EX); fputs($f,$new); fclose($f); }
Time of Update: 2016-07-25
class httpClient { public $buffer = null; // buffer 擷取返回的字串 public $referer = null; // referer 設定 HTTP_REFERER 的網址 public $response = null; // response 伺服器響應的 header 資訊 public $request = null; // request 發送到伺服器的
Time of Update: 2016-07-25
圖片處理函數功能:縮放、剪下、相框、浮水印、銳利化、旋轉、翻轉、透明度、反色,處理並儲存記錄的思路:當有圖片有改動時自動產生一張新圖片,命 名方式可以考慮在原圖片的基礎上加上步驟,例如:圖片名稱+__第幾步。 在一些需要圖片進階處理功能的Web應用中,可以參考這個類。 /*圖片處理函數功能:縮放、剪下、相框、浮水印、銳利化、旋轉、翻轉、透明度、反色處理並儲存記錄的思路:當有圖片有改動時自動產生一張新圖片,命名方式可以考慮在原圖片的基礎上加上步驟,例如:圖片名稱+__第幾步*/class
Time of Update: 2016-07-25
define('HOST_FILE', 'C:\Windows\System32\drivers\etc\hosts'); $hm = new HostManage(HOST_FILE); $env = $argv[1]; if (empty($env)) { $hm->delAllGroup(); } else { $hm->addGroup($env); }
Time of Update: 2016-07-25
class GeoHelper{ /** * @param int $lat1 * @param int $lon1 * @param int $lat2 * @param int $lon2 * @param string $unit * @return */ public static function distance($lat1, $lon1, $lat2, $lon2, $unit = "K") {
Time of Update: 2016-07-25
/* * memcache隊列類 * 支援多進程並發寫入、讀取 * 邊寫邊讀,AB面輪值替換 * @author guoyu * @create on 9:25 2014-9-28 * @qq技術行業交流群:136112330 * * @example: * $obj = new memcacheQueue('duilie'); * $obj->add('1asdf');
Time of Update: 2016-07-25
//代碼也可以用於統計目錄數//格式化輸出目錄大小 單位:Bytes,KB,MB,GB function getDirectorySize($path){ $totalsize = 0; $totalcount = 0; $dircount = 0; if ($handle = opendir ($path)) { while (false !== ($file = readdir($handle))) { $nextpath = $path . '/' . $
Time of Update: 2016-07-25
//人民幣金額轉大寫程式PHP版class Ext_Num2Cny{ static $basical = array(0=>"零","壹","貳","三","肆","伍","陸","柒","捌","玖"); static $advanced=array(1=>"拾","佰","仟"); public static function ParseNumber($number){ $number=trim($number); if ($number>999999999999)
Time of Update: 2016-07-25
function DateDiff($date1, $date2, $unit = "") { //時間比較函數,返回兩個日期相差幾秒、幾分鐘、幾小時或幾天 switch ($unit) { case 's': $dividend = 1; break; case 'i': $dividend = 60; //oSPHP.COM.CN break; case '