Time of Update: 2016-07-25
無資料庫支援的簡單留言板,主要是對檔案方式儲存和讀取資料的練習。 /** * 這是一個單頁面沒有資料庫支援的留言板系統 * 知識點: * 1、heredoc文檔的使用:>>>EOTEOT; 第二個EOT行前不能有任何空格 * 2、檔案的讀寫操作 *
Time of Update: 2016-07-25
/*$array_name:傳入的數組;$row_id:數組想排序的項;$order_type:排序的方式,ASC或者DESC;*/ function array_sort($array_name,$row_id,$order_type){ $array_temp=array(); foreach($array_name as $key=>$value){//迴圈一層;
Time of Update: 2016-07-25
很基礎的東西,感覺代碼還不夠簡潔,希望高手指導修改, 轉自PHP面試題: http://phpmst.com/ function BubbleSort($str){for($i=0;$ifor ($k=count($str)-2;$k>=$i;$k--){//將這個值向前冒泡;if($str[$k+1]$tmp=$str[$k+1];$str[$k+1]=$str[
Time of Update: 2016-07-25
/* * Created on 2010-10-27 * BY QQ542900563 * Copyrights Reserved 2000-2020 * 本例示範圖片浮水印的產生辦法 *///分別載入兩張圖片$im=imagecreatefromjpeg("liu.jpg");$img2=imagecreatefrompng("m.png"); //取得各自的長寬,計算位置$im_WH=getimagesize("liu.jpg");$im_W=$im_WH[0];$im_H=$im_WH[1
Time of Update: 2016-07-25
檔案1:【error.class.php】重寫錯誤處理,進行檔案型的日誌輸出,會有兩個時間,第一個是格林尼治時間,第二個是北京時間,後面是錯誤資訊,使用時候只需要包含此檔案就可以了。 當然,檔案格式你也可以根據自己的需要進行相應修改,比如在後面可以加一個mail函數發送到郵件... 檔案2:【test.php】測試檔案,裡面有用來測試的錯誤語句。
Time of Update: 2016-07-25
從表單擷取兩個數組, 一是要更新欄位資料 , 另一個是條件數組, 我這裡用id 來源:http://www.liuhai.org/sql-set-key-case-when-then function save_category_district($parame,$id){if(!is_array($parame) || !is_array($id))
Time of Update: 2016-07-25
$flag = 0; //要post的資料 $argv = array( 'sn'=>'SDK-BBX-010-XXXXX', 'pwd'=>'XXXXXX', 'mobile'=>'15201692834', 'content'=>'你好嗎,測試簡訊' ); //構造要post的字串 foreach ($argv as $key=>$value) {
Time of Update: 2016-07-25
使用方法:在網站的流量大的頁面,一般為首頁用 iframe 調用上面的代碼即可,如插入 轉載地址: http://blog.qita.in/?post=327 很多時候,我們需要用到定時產生html頁面的功能,原理簡介:利用檔案如index.html的最後修改時間和當前的時間做比較,當時間差超過一定間隔如2小時,則調用相關頁面進行產生新頁面。原始原始碼如下。
Time of Update: 2016-07-25
// display error is On for us to be notified if there's something wrong ini_set ( 'display_errors', 'On' ); error_reporting ( E_ALL ); // Config, change this variables $dbServer = "localhost"; $dbUser = "帳號"; $dbPass = "密碼"; $dbName =
Time of Update: 2016-07-25
轉載地址: http://blog.qita.in/?post=275 使用方法: require_once('360.php'); //http://blog.qita.infunction customError($errno, $errstr, $errfile, $errline){ echo "Error number: [$errno],error
Time of Update: 2016-07-25
線上解壓zip $zipfile = 'test.zip';$zipdir = './test/';$zip = new ZipArchive();$rs = $zip->open($zipfile);if($rs !== TRUE){die('Error :'. $rs);}$zip->extractTo($zipdir);$zip->close();//unlink(
Time of Update: 2016-07-25
PHP開啟CSV檔案 //設定UTF-8編碼setlocale(LC_ALL, 'en_US.UTF-8');//csv路徑$csv_file = "csv/excel.csv";//以唯讀方式開啟檔案$handle = fopen($csv_file, "r");//定義結果數組$listarr =
Time of Update: 2016-07-25
PHP仿GD產生BMP圖片 function imagebmp(&$im, $filename = '', $bit = 8, $compression = 0){if (!in_array($bit, array(1, 4, 8, 16, 24, 32))){$bit = 8;}else if ($bit == 32) // todo:32 bit{$bit = 24
Time of Update: 2016-07-25
我們都遇到過這樣的情況:某WEB應用頁面其搜尋條件很多,有時一個參數對應很多值,或者說有很強的上下級關係,比如租房網: 戶型參數有:一室一廳、一室兩廳等等。 這時候要給某一個塞選條件符上正確的URL參數就比較麻煩,為了不整天做重複的工作,我們寫了下面這個方法。 例子我們用租房網的例子來參考(注意以下僅是示範,所以不講究規範啥的)。 地區(area): 不限('')、區一(area1)、區二(area2)、區三(area3).......
Time of Update: 2016-07-25
無限分類,從資料庫查詢資料 在數組中遞迴進行自訂排序,其中也意識到挺多不足,處理得不好,可能有更好辦法,大家一起交流 超過100行了。放不全 class Tree{protected $arr = array();//排序數組protected $info = array();//存放錯誤資訊protected $tree = array(); //
Time of Update: 2016-07-25
代碼來自本人部落格: http://www.taoniwu.com/archives/3234.html各位大神如果有什麼好的建議,感謝提出~~~~~ ?class Collection{protected $url;//採集地址protected $prefix;//重新命名檔案首碼protected
Time of Update: 2016-07-25
提取discuz安裝進度顯示,比如什麼什麼資料表建立完成,什麼什麼檔案建立完成! 昨天有個同學提問 http://www.oschina.net/question/13403_74988 ,花了點時間把discuz的提取出來。 開始我也以為是ajax完成,原來不是。至於進度條什麼的這個可以自由發揮。
Time of Update: 2016-07-25
迅雷專用連結 普通下載地址頭部加入AA 尾部加入ZZ後通過base64編碼 最後頭部加上thunder:// 旋風專用連結 比較省事 普通下載地址直接通過base64編碼 最後頭部加上qqdl:// 快車專用連結 普通下載地址頭尾分別加入[FLASHGET]後通過base64編碼 最後頭部加上flashget:// 轉載地址:http://blog.qita.in/?post=334
Time of Update: 2016-07-25
$xp = new xf_HtmlDom(); $xp->loadHtml('http://dealer.bitauto.com/100040078/cars.html'); $rows = $xp->find('dl/dd/a', 0)->innertext; print_r($rows);
Time of Update: 2016-07-25
CURL抓取惠民單車服務點 車輛資訊 /** * 惠民單車服務點 車輛資訊 * @Support:QQ 910111100 (JoY) * @Time: 2012.09.29 15:50:00 * @HZapi.com (http://www.hzapi.com/)*/$url = "http://www.2773456.com/zdfb/huizhou_station.