一個用於php二維數組排序的自訂函數,分享一下,有用到的朋友看看吧。代碼如下:$v){ $keysvalue[$k] = $v[$keys]; } if($type == 'asc'){ asort($keysvalue); }else{ arsort($keysvalue); } reset($keysvalue); foreach ($keysvalue as $k=>$v){ $new_array[$k] =
分享一個php分頁類,寫的不錯,提供了二個該分頁類的調用執行個體,供大家學習參考。1,php分頁類代碼 Number = $number; $this-> N_p_p = $n_p_p; $this-> Pages = ceil ( $this-> Number / $this-> N_p_p ) ; $this->
1、一個IT工程師應該具有的技能我認為實用技能包含3個方面,1所示: 圖1這些都是很重要的:●編碼:你必須能夠在限定時間內編寫出高品質的代碼。●經驗:具有相關經驗表明你對該行業的熱情,並能夠在一開始就進入工作狀態。●理論:理論知識是IT工程師的基礎,好的理論知識能夠讓你快速解決新出現的問題。而準備工作面試的過程是一個提升自己各種能力的絕佳機會。1、提高你的理論知識(1)學習C語言
/* * desc: Resize Image(png, jpg, gif)*/class ResizeImage {//圖片類型private $type;//實際寬度private $width;//實際高度private $height;//改變後的寬度private $resize_width;//改變後的高度private $resize_height;//是否裁圖private $cut;//源圖象private $srcimg;//靶心圖表象地址private $dstimg;//
# tar -zxf (此處填下載的curl包名稱)# ./configure –prefix=/usr/local/curl# make; make install複製代碼安裝php時,只要開啟開關
/** php分頁查詢代碼* */$perpagenum = 10;//定義每頁顯示幾條 $total = mysql_fetch_array(mysql_query("select count(*) from a"));//查詢資料庫中一共有多少條資料 $Total = $total[0]; // $Totalpage = ceil($Total/$perpagenum);//上舍,取整 if(!isset($_GET['
header("Content-type:application/vnd.ms-excel");header("Content-Disposition:filename=test.xls");echo "test1\t";echo "test2\t\n"; //兩列之後換行echo "test1\t";echo "test2\t\n";echo "test1\t";echo "test2\t\n";echo "test1\t";echo "test2\t\n";echo
return array( 'DB_TYPE'=>'mysql', 'DB_HOST'=>'127.0.0.1', 'DB_NAME'=>'w3note', 'DB_USER'=>'root', 'DB_PWD'=>'123456', 'DB_PORT'=>'3306', 'DB_PREFIX'=>'w3_',
本文分享一個不錯的php檔案上傳,可以實現單個檔案的上傳、多個檔案的上傳功能。有需要的朋友參考下吧。1,php檔案上傳類language = "en"; // choice of en, nl, es $this->rename_file = false; $this->ext_string = ""; } function show_error_string() { $msg_string = ""; foreach ($this->message as $value) {
private function _addEtag($file) { $last_modified_time = filemtime($file); $etag = md5_file($file); // always send headers header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT"); header("Etag: $etag"); //
//擷取要清楚的目錄和目錄所在的絕對路徑 public function cache(){ ////前台用ajax get方式進行提交的,判斷下 if($_POST['type']){ //得到傳遞過來的值 $type=$_POST['type']; //將傳遞過來的值進行切割,我是用“-”進行切割的 $name=explode('-', $type); //得到切割的條數,便於下面迴圈 $count=count($name); //迴圈調用上面的方法
在mysql資料庫中插入帶有單引號或雙引號的字串時,如果是單個字串,可以考慮用反斜線進行轉義,如果是大批量的資料需要轉換呢,又該怎麼辦呢?參考下本文中的介紹吧。如果有大量的內容需要轉義,可以考慮mysql_real_escape_string函數:mysql_real_escape_string — 轉義 SQL 陳述式中使用的字串中的特殊字元,並考慮到串連的當前字元集。注意:該函數並不轉義 % 和
// put this above any php image generation code:session_start(); header("Cache-Control: private, max-age=10800, pre-check=10800");header("Pragma: private");header("Expires: " . date(DATE_RFC822,strtotime(" 2 day")));複製代碼在header("Content-type:
$file="./cache/file.cache"; $array = array("color" => array("blue", "red", "green"), "size" => array("small", "medium", "large")); //緩衝 file_put_contents($file,serialize($array));//寫入緩衝 //讀出緩衝 $handle = fopen($file,
//為了避免重複包含檔案而造成錯誤,加了判斷函數是否存在的條件:if(!function_exists(pages)){
$array=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20");//規定要分頁的數組$page= $_GET['page'];$r = $this->page($array,5,$page);print_r($r);exit();foreach($r["source"] as $s){echo $s;}function
$data[] = array('volume' => 67, 'edition' => 2);$data[] = array('volume' => 86, 'edition' => 1);$data[] = array('volume' => 85, 'edition' => 6);$data[] = array('volume' => 98, 'edition' => 2);$data[] = array('volume' => 86, 'edition' => 6);$data[] =
static function getMenuTree($arrCat, $parent_id = 0, $level = 0,$all=True){static $arrTree; //使用static代替globalif(!$all) $arrTree ='';if( empty($arrCat)) return FALSE;$level++;if($level == 1) $arrTree[] = $parent_id;foreach($arrCat as $key => $value)
function guid(){if (function_exists('com_create_guid')){return com_create_guid();}else{mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.$charid = strtoupper(md5(uniqid(rand(), true)));$hyphen = chr(45);// "-"$uuid = chr(123)// "{".
/** * * *等比縮放 * @param unknown_type $srcImage 源圖片路徑 * @param unknown_type $toFile 靶心圖表片路徑 * @param unknown_type $maxWidth 最大寬 * @param unknown_type $maxHeight 最大高 * @param unknown_type $imgQuality 圖片品質 * @return unknown */ function