Time of Update: 2016-07-25
/*** 返回一個唯一在本地系統中獨一無二的字串,* 返回的是32個字元的字串,形式如'7dac352074f221f3edc74d265c65a636',或'd198d8fc56ffed627f3f8313d6f06acf'*/function LUID(){return MD5(microtime());}?> 複製代碼其實就一行:return MD5(microtime());按道理microtime()返回的字串就已經是唯一的了,測了一下,即使連續執行microtime(),傳回值也有1
Time of Update: 2016-07-25
package com.sjzmlb.test;/** * * @author sjzmlb * */public class TestArray {public static void main(String[] args) {// -----不規則二維數組 ----int[][] ints = new int[5][];for (int i = 0; i ints[i] = new int[i + 1];for (int j = 0; j ints[i][j] = i + 1;}}for
Time of Update: 2016-07-25
php超級全域變數數組(Super Global Array),又稱為php預定義數組,是由php引擎內建的,不需要開發人員重新定義。介紹:php超級全域變數數組(Super Global Array),又稱為php預定義數組,是由php引擎內建的,不需要開發人員重新定義。在php指令碼運行時,PHP會自動將一些資料放在超級全域數組中。php超級全域變數$_GET[] 獲得以GET方法提交的變數數組$_POST[] 獲得以POST方法提交的變數數組$_COOKIE[]
Time of Update: 2016-07-25
/*** 目錄產生類 :UtilsMakeDir* @author yepeng* @since 2010.3.18*/class UtilsMakeDir{//基目錄 建立目錄時不會對這個目錄進行建立。這應該是個已經存在的目錄private static $makeBasePath = 'video';private static $delBasePath = 'video';/*** 遞迴建立目錄,* 建立成功返回這個全路徑,* 建立失敗返回false* @param String
Time of Update: 2016-07-25
#-------------- .htaccess start ---------------RewriteEngine onRewriteRule !\.(js|ico|gif|jpg|png|css|swf|htm|txt)$ index.phpphp_flag magic_quotes_gpc offphp_flag register_globals off#-------------- .htaccess end
Time of Update: 2016-07-25
前東家是一家遊戲公司,老闆很好,當時工作也留下了很多自己原創的管理指令碼。現在分享一下在辦公環境使用Java、Jsch登入VPN管理Linux的指令碼(此處實現JAVA調用Linux上備份Mysql的shell作為樣本),希望對營運的朋友有協助,儘快從繁雜的伺服器管理工作中脫離出來。 主要的實現思路:
Time of Update: 2016-07-25
從網上找的,讀取檔案,改變索引值對的方法。 package com.sdut.edu.tools;import
Time of Update: 2016-07-25
在一個練習小項目中學習到的 package com.sdut.edu.tools;import
Time of Update: 2016-07-25
/** 遞迴刪除目錄及其下的所有檔案 func: rrmdir*/function rrmdir($dir) {if (is_dir($dir)) {$objects = scandir($dir);foreach ($objects as $object) {if ($object != “.” && $object != “..”) {if (filetype($dir.”/”.$object) == “dir”) rrmdir($dir.”/”.$object); else
Time of Update: 2016-07-25
function ClearHtml($content,$allowtags='') {mb_regex_encoding('UTF-8');//replace MS special characters first$search = array('/‘/u', '/’/u', '/“/u', '/”/u', '/—/u');$replace = array('\'', '\'', '"', '"', '-');$content = preg_replace($search, $replace,
Time of Update: 2016-07-25
//方法一:function extend_1($file_name){$retval="";$pt=strrpos($file_name, ".");if ($pt) $retval=substr($file_name, $pt+1, strlen($file_name) - $pt);return ($retval);}//方法二function extend_2($file_name){$extend = pathinfo($file_name);$extend = strtolower(
Time of Update: 2016-07-25
Header("Content-type: image/png"); /*通知瀏覽器,要輸出映像*/$im = imagecreate(400 , 300); /*定義映像的大小*/$gray = ImageColorAllocate($im , 235 , 235 , 235);$pink = ImageColorAllocate($im, 255 , 128 , 255);$fontfile = "simkai.ttf";/* $fontfile 字型的路徑,視作業系統而定,可以是
Time of Update: 2016-07-25
//------------------------------------- // 檔案說明:檔案上傳處理類 // 檔案作者:Jesse Lee //------------------------------------- class upload { var $dir; //附件存放物理目錄 var $time; //自訂檔案上傳時間 var $allow_types; //允許上傳附件類型 var
Time of Update: 2016-07-25
簡易的smarty 對新手理解smarty有協助 源於itcast韓順平老師smarty第2、3講 class MyMiniSmarty{public $template_dir = "./templates";public $complie_dir = "./templates_c";public $tpl_vars = array();public
Time of Update: 2016-07-25
友言 Uyan 是第三方評論、留言外掛程式。 讓使用者可以通過QQ、微薄等帳號發布評論和留言。 在 羊駝!CMS 中整和 Uyan 方法如下。 以建立友言留言板為例。 0. 訪問 http://uyan.cc/getcode 複製友言代碼 1. 點擊 後台 -> 排版 -> 添加排版 2. 輸入 名稱 ->留言板 代碼 -> 粘帖友言代碼 儲存 3. 點擊 後台-> 內容 -> 添加頁面 4. 輸入 標題 -> 留言板
Time of Update: 2016-07-25
function page_init(){$url = $_SERVER['REQUEST_URI'];//子url,該參數一般是唯一的$pageid = md5($url);$dir = str_replace('/','_',substr($_SERVER['SCRIPT_NAME'],1,-4));//目錄命名方式,如exp_indexif(!file_exists($pd = PAGE_PATH.$dir.'/'))@mkdir($pd,0777) or die("$pd目錄建立失敗")
Time of Update: 2016-07-25
我在看那個ecmall核心檔案ecmall.php,看到這個函數寫得比較清晰,拿出來分享下 function get_domain() { /* 協議 */ $protocol = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : '
Time of Update: 2016-07-25
Class GB2UTF8{var $gb; // 待轉換的GB2312字串var $utf8; // 轉換後的UTF8字串var $CodeTable; // 轉換過程中使用的GB2312代碼檔案數組var $ErrorMsg; // 轉換過程之中的錯誤訊息function GB2UTF8($InStr=""){$this->gb=$InStr;$this->SetGb2312();($this->gb=="")?0:$this->Convert();}function SetGb2312($
Time of Update: 2016-07-25
//對照表的使用$filename = "gb2utf8.txt";$fp = fopen($filename,"r");while(! feof($fp)) {list($gb,$utf8) = fgetcsv($fp,10);$charset[$gb] = $utf8;}fclose($fp);//以上讀取對照表到數組備用/** gb2312到utf-8 **/function gb2utf8($text, &$charset)
Time of Update: 2016-07-25
位元組順序記號(英:byte-order mark,BOM)是位於碼點 U+FEFF 的統一碼字元("零寬度無斷空白")。當以 UTF-16 或 UTF-32 來將UCS/統一碼字元所組成的字串編碼時,這個字元被用來標示其位元組序。它常被用來當做標示檔案是以 UTF-8 、 UTF-16 或 UTF-32 編碼的記號。 class cryption {function