Time of Update: 2016-07-25
/*** 監控日誌 500 503錯誤* by bbs.it-home.org*/include("PHPMailer/class.phpmailer.php");//error_reporting(0);$mail = new PHPMailer();$mail->IsSMTP(); // telling the class to use SMTP$mail->SMTPDebug = 1; // enables SMTP
Time of Update: 2016-07-25
/** * Detect upload file type * 檢測上傳檔案的excel檔案類型 * @param array $file * @return bool $flag * @site bbs.it-home.org */ private function detectUploadFileMIME($file) { // 1.through the file extension judgement 03 or 07 $flag = 0
Time of Update: 2016-07-25
/*** 去除重複的圖片檔案* by bbs.it-home.org*/exec("find . -type f", $lines);$arr = array();$del = array();$n = 0;foreach($lines as $line){ $line = trim($line); if(!$line){ continue; } $n ++; $md5 = md5_file($line); if(isset($arr[$md5])){ $del[] = $line; //
Time of Update: 2016-07-25
CREATE TABLE IF NOT EXISTS `downloads` ( `id` int(6) unsigned NOT NULL AUTO_INCREMENT, `filename` varchar(50) NOT NULL, `savename` varchar(50) NOT NULL, `downloads` int(10) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY
Time of Update: 2016-07-25
// 快速的判斷$a數組是否是$b數組的子集 $a = array(135,138); $b = array(135,138,137); 複製代碼實現方法:方法1,for迴圈遍曆 $flag = 1; foreach ($a as $va) { if (in_array($va, $b)) { continue; }else { $flag = 0; break; } } if ($flag) {
Time of Update: 2016-07-25
輸入您註冊的電子郵箱,找回密碼: 複製代碼當使用者輸入完郵箱並點擊提交後,jQuery先驗證郵箱格式是否正確,如果正確則通過向後台sendmail.php發送Ajax請求,sendmail.php負責驗證郵箱是否存在和發送郵件,並會返回相應的處理結果給前台頁面。jQuery代碼: $(function(){ $("#sub_btn").click(function(){ var email = $("#email").val(); var preg =
Time of Update: 2016-07-25
我算是靠坑蒙拐騙進了程式員的門,然後一路狂奔。26歲之前幾乎沒有任何寫代碼的經驗,研究生畢業卻意外選擇了一家不可能提供培訓的初創公司,在每日擔憂公司倒閉、害怕被炒魷魚以及同事冷落白眼的三重壓力下逆流而上,一年半後離職,已是擁有500萬使用者產品的後台主程。從前我對電腦技術心懷畏懼,認定技術高人一定有佛光籠罩,晝夜不息運鍵如飛日吐代碼上萬行。現在也算見過一些世面了,回首那段忐忑不安宛如初夜的過程,我卻不發覺有任何的勵志意味,而是視為一種理所當然。理想的程式員,和理想的建築師、理想的財務師、理想的按
Time of Update: 2016-07-25
CREATE TABLE IF NOT EXISTS `votes` ( `id` int(10) NOT NULL AUTO_INCREMENT, `likes` int(10) NOT NULL DEFAULT '0', `unlikes` int(10) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `votes` (`id`,
Time of Update: 2016-07-25
/*** smarty模板引擎中使用php函數* by bbs.it-home.org*/require 'libs/Smarty.class.php'; $smarty=new Smarty; $smarty->compile_check=true; $smarty->debugging=true; $str1='testtesttesttest'; $str2='this is a'; $str3='指令碼 學堂
Time of Update: 2016-07-25
$arr = array("a" => 1,"b" => 2,"c" => 3); 複製代碼如果這樣定義數組會報編譯錯誤: $arr = array("a" = 1,"b" = 2,"c" = 3); 複製代碼因此,定義數組的時候只能用 => 2、 $arr = array("a" => 1,"b" => 2,"c" => 3);echo $arr[0];echo $arr[1]; 複製代碼打出來的是一片空白。正確的列印方法: echo
Time of Update: 2016-07-25
/*** 產生指定長度的字串* by bbs.it-home.org*/function create_random_string($random_length) { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $random_string = ''; for ($i = 0; $i $random_string .= $chars [mt_rand(0,
Time of Update: 2016-07-25
/*** php代碼實現excel檔案下載* edit: bbs.it-home.org*/if (file_exists(CACHE_PATH . $file_name)){ //$this->logger->error('file realpath:'.realpath(CACHE_PATH . $file_name)); header( 'Pragma: public' ); header( 'Expires: 0' ); header(
Time of Update: 2016-07-25
/*** phpexcel類庫匯出excel檔案* edit: bbs.it-home.org**/require 'php-excel.class.php';//引用Google的phpexcel 類$result = mysql_query("SELECT * FROM dingdan"); //查詢一個資料表,並返回記錄集$data = array( 1 => array ('訂單編號', '線路名稱'),);while($row =
Time of Update: 2016-07-25
function FetchRepeatMemberInArray($array) { // 擷取去掉重複資料的數組 $unique_arr = array_unique ( $array ); // 擷取重複資料的數組 $repeat_arr = array_diff_assoc ( $array, $unique_arr ); return $repeat_arr; } // 測試案例 $array = array (
Time of Update: 2016-07-25
/** string filter class * Date: 2013-01-09 * Author: fdipzone * Ver: v1.0 * Edit: bbs.it-home.org* Func: * public replace 替換非法字元 * public check 檢查是否含有非法字元 * private protect_white_list 保護白名單 * private resume_white_
Time of Update: 2016-07-25
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user 訪問phpmyadmin使用的mysql使用者名稱 fg['Servers'][$i]['password'] = ''; // MySQL password (only needed對應上述mysql使用者名稱的密碼複製代碼D.認證方法 $cfg['Servers'][$i]['auth_type'] = 'cookie';
Time of Update: 2016-07-25
cd libpng-1.2.40mv scripts/makefile.linux ./Makefile #一定要使用script下的Makefile ,不要通過./configure複製代碼產生: makemake install複製代碼2,下載freetype庫,很多GD函數都需要此庫的支援http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.3.5.tar.gz解壓後,進入目錄: cd
Time of Update: 2016-07-25
//Unicode編碼解碼轉換function unicode_encode($name){ $name = iconv('UTF-8', 'UCS-2', $name); $len = strlen($name); $str = ''; for ($i = 0; $i { $c = $name[$i]; $c2 = $name[$i + 1]; if (ord($c) > 0) {
Time of Update: 2016-07-25
# tar zxvf httpd-2.2.6.tar.gz# cd httpd-2.2.6# ./configure --prefix=/usr/local/apache2 --enable-so --enable-track-vars --enable-proxy --enable-vhost-alias --enable-cache --enable-disk-cache --enable-mem-cache --enable-rewrite
Time of Update: 2016-07-25
[root@jbxue ~]# yum install php-gd*Setting up Install ProcessSetting up repositoriesbase 100% |=========================| 951 B 00:00update 100% |=========================| 951 B 00:00Reading