Time of Update: 2016-07-25
無重新整理上傳檔案 複製代碼檔案: upload.php sleep(2);$fileTypes = array('jpg','png','gif','bmp');$result = null;$uploadDir = './upfiles';$maxSize = 1 * pow(2,20);if ($_SERVER['REQUEST_METHOD'] == 'POST' &&
Time of Update: 2016-07-25
/** * 圖片相似性比較 * * @version $Id: ImageHash.php 4429 2012-04-17 13:20:31Z jax $ * @authorjax.hu * www.osxue.com*//Sample_1 *$aHash = ImageHash::hashImageFile('wsz.11.jpg'); *$bHash = ImageHash::hashImageFile('wsz.12.jpg');
Time of Update: 2016-07-25
cd /etc/yum.repos.d/ cp CentOS-Base.repo CentOS-Base.repo.bak複製代碼1.2替換源 用vi開啟CentOS-Base.repo,並將內容清空,然後將下面的內容複寫進去,並儲存。 yum -y update複製代碼2. 用yum安裝Apache,Mysql,PHP.2.1安裝Apache yum install httpd httpd-devel 複製代碼安裝完成後,用/etc/init.d/httpd start
Time of Update: 2016-07-25
$nav='';//用來儲存頁數的一個變數 for ($i=1;$i{ $nav.="第".$i."頁 "; }複製代碼以上的for迴圈將輸出如 第1頁,第2頁,第3頁,第4頁,第5頁,第6頁,第7頁,第8頁,第9頁,第10頁,第11頁,第12頁,第13頁 如果我們只想每次只顯示十個頁面呢?比如1-10頁,11-20頁 稍微修改下for迴圈即可: $step= floor(($pageNow-1)/10)*10+1; for ($i=$step;$i{ $nav.="第".$i."頁
Time of Update: 2016-07-25
$last_line = system("ls", $retval);echo "Last line of the output: " . $last_line;echo "Return value: " . $retval;?>複製代碼exec函數說明:執行外部程式。文法:string exec(string command, string [array], int [return_var]);傳回值: 字串詳細介紹:本函數執行輸入 command
Time of Update: 2016-07-25
使用Regex進行尋找替換 首先需要聲明的是,其實我對正則的應用也不是特別地熟練,只不過是在工作中“被逼無奈”才一步步地對正則有了一些瞭解。隨著對正則的瞭解越多,越來越發現Regex真的是一個很強有力的工具,使用正則,很多時候都可以事半功倍。 網上流傳著很多通用的正則,比如說尋找電話號碼的正則,尋找email的正則。相信也有很多朋友跟我一樣,學習正則是從這些流行的正則開始的,當體會到了正則的強大,而這些流行的正則不再合用時,就有了學習正則的動力。其實正則的基本規則很簡單,入門很容易,
Time of Update: 2016-07-25
header("Content-type:text/html;charset=utf-8");$str = '';$pattern = "/[img|IMG].*?src=['|\"](.*?(?:[.gif|.jpg]))['|\"].*?[\/]?>/";preg_match_all($pattern,$str,$match);echo "";print_r($match);?>複製代碼附,php過濾html標籤、屬性等Regex匯總。 function DeleteHtml($str){$
Time of Update: 2016-07-25
// function with 2 optional argumentsfunction foo($arg1 = '', $arg2 = '') { echo "arg1: $arg1\n"; echo "arg2: $arg2\n";}foo('hello','world');/* prints:arg1: helloarg2: world*/foo();/* prints:arg1:arg2:*/複製代碼如何建立能夠接受任何參數數目的函數。需要使用 func_get_args() 函數:
Time of Update: 2016-07-25
本文介紹了wordpress只支援上傳圖片的實現方法,使用自訂函數實現圖片上傳功能,不允許其它檔案上傳,需要的朋友參考下。wordpress支援上傳圖片在添加文章時,wordpress支援添加媒體,包括圖片、視頻、word和excel等各種多媒體檔案。擷取wordpress支援上傳的所有檔案類型,可以在當前主題的functions.php中插入以下php代碼。然後,開啟部落格首頁,查看網頁原始碼,即可看到一個完整的支援列表(bbs.it-home.org
Time of Update: 2016-07-25
介紹下php中is_file與file_exists的區別,is_file 只判斷檔案是否存在;file_exists 判斷檔案是否存在或者是目錄是否存在;分享下php中is_file與file_exists的區別,供大家參考。is_file 只判斷檔案是否存在;file_exists 判斷檔案是否存在或者是目錄是否存在;is_dir
Time of Update: 2016-07-25
set_time_limit(13600); //設定時間$conn=mysql_connect('localhost','root',''); //串連資料庫mysql_select_db('csdn',$conn);mysql_query("SET NAMES utf8");$file=file('csdn.txt');foreach($file as $line){ $u=explode('# ', $line); mysql_query("INSERT INTO
Time of Update: 2016-07-25
$filename="test.dat";//定義操作檔案$delline=3;
Time of Update: 2016-07-25
function upload_file($fname,$ftype,$fsize,$ferror,$ftmp_name,$fpath){ date_default_timezone_set('PRC'); $store_nm = date("YmdHis") . "-" . rand(10000,99999) . "-". strlen($fname)."-$fname"; if($fname){ if ( ( ($ftype ==
Time of Update: 2016-07-25
$array = array("北京"=>1925,"上海"=>2016,"廣州"=>1256,"深圳"=>980);$arr_key = array_keys($array);$color = array();$im = imagecreatetruecolor(300,300);for($i=1;$i $color[] =
Time of Update: 2016-07-25
//繪圖技術 基本步驟 前提:在php.ini檔案中啟用gd庫//建立畫布 預設背景是黑色的$img=imagecreatetruecolor(400,300);//繪製各種圖形//建立一個顏色$background = imagecolorallocate($img, 255, 0,
Time of Update: 2016-07-25
class DemoSubject implements SplSubject{ private $observers, $value; public function __construct(){ $this->observers = array(); } public function attach(SplObserver $observer){ $this->observers[] = $observer; }
Time of Update: 2016-07-25
function debug($var, $val){echo "***DEBUGGING\nVARIABLE: $var\nVALUE:";if (is_array($val) || is_object($val) || is_resource($val)) {print_r($val);} else {echo "\n$val\n";}echo "***\n";}$c = mysql_connect();$host =
Time of Update: 2016-07-25
//------------------------------------- // 檔案說明:檔案上傳處理類 // 檔案作者:Jesse Lee // 作者首頁:http://bbs.it-home.org // 最後更新:2011-5-14 //------------------------------------- class upload { var $dir; //附件存放物理目錄 var $time;
Time of Update: 2016-07-25
//1、建立畫布$im = imagecreatetruecolor(300,200);//建立一個真彩色映像,預設背景是黑色,返回映像標識符。另外還有一個函數 imagecreate 已經不推薦使用。//2、繪製所需要的映像$red =
Time of Update: 2016-07-25
class A{ public $name; function test1($a){ echo "test1111"; } function test2($a){ echo "test2222"; } //當某個對象調用某個方法,而當該方法不存在時,則系統會自動調用__call() function __call($method,$val){ echo "類中找不到方法:".$method; }}$aaa = new A();$aaa ->test(1);?> 複製代碼輸出結果:類中找不到方法: