Time of Update: 2017-01-13
這裡就就給大家詳細說一下PHP流程式控制制的替代文法。什麼是替代文法?簡單的說就是一些文法的另類寫法。PHP中那些文法有替代文法?流程式控制制(包括if,while,foreach,switch)這幾個語句有替代文法。替代文法的基本形式:左花括弧({)換成冒號(:),把右花括弧(})分別換成 endif;,endwhile;,endfor;,endforeach; 以及 endswitch;舉個例子吧:舉個例子吧:<?php if ($a<0): ?>是負數拉<?php
Time of Update: 2017-01-13
使用curl需要在php.ini中設定啟用才行 >< Windows的伺服器中,開啟php.ini,找到:extension=php_curl.dll去掉前面的注釋既可 。實現代碼如下: 代碼如下複製代碼 $curl = curl_init();$url=’http://www.111cn.net’;curl_setopt($curl, CURLOPT_URL, $url); //設定URLcurl_setopt($curl,
Time of Update: 2017-01-13
英文: 代碼如下複製代碼 function tourl($str) { $str = preg_replace('/[^a-zA-Z0-9]+/', '-', $str); $str = trim($str, '-'); return strtolower($str);} 包含特殊字元: 代碼如下複製代碼 function strtourl($str) { $str =
Time of Update: 2017-01-13
用法nlink() 函數刪除檔案。若成功,則返回 true,失敗則返回 false。文法unlink(filename,context)樣本: 代碼如下複製代碼 $tmpdata = $this->_agency_mod->find ( intval ( $value ) );$img = $tmpdata [$value] ['agency_image'];if(!empty($img)){ $img = '../data/agency/' .
Time of Update: 2017-01-13
在用PHP5.3以上的PHP版本時,只要是涉及時間的會報一個“PHP Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings.You are *required* to use the date.timezone setting or the date_default_timezone_set() function.In case you used
Time of Update: 2017-01-13
用PHP給上傳圖片加浮水印的程式是通過判定檔案類型建立圖形,然後把其複製到原建立的圖形上,填充並建立rectangle,以備寫入imagestring()或是原已經定好的映像程式當中判定浮水印類型:一是字串,另是增加一個繪圖物件在上面。假如你對PHP的GD庫比較熟悉,看懂這篇文章一點都不難了!/***************************************************** 參數說明: $max_file_size : 上傳檔案大小限制, 單位BYTE
Time of Update: 2017-01-13
<? //讀取映像的類型 //1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF function
Time of Update: 2017-01-13
代碼如下複製代碼 class upfile { public $filepath = "www.111cn.net/"; //上傳檔案存放檔案夾 public $filesize = 1000000; //允許上傳的大小 //如果要修改允許上傳檔案的類型 請搜尋 【 switch ($upfiletype) { //檔案類型 】 public $reimagesize =
Time of Update: 2017-01-13
function image3($length=4,$type='png',$width=180,$height=60,$fontface='fpnf.ttf',$verifyName='verify') { $code = $this->rand_string($length,4); $width =
Time of Update: 2017-01-13
function Watermark_IM($preview = 0) { global $watermarkstatus, $watermarktype, $watermarktrans, $watermarkquality, $watermarktext, $imageimpath; $watermarkstatus = $GLOBALS['forum']['disablewatermark'] ? 0 :
Time of Update: 2017-01-13
只要安裝一些第三方的庫檔案並具有一定的幾何知識,就可以利用PHP來建立和處理映像了。利用PHP建立生動影像是相當容易的一件事情。下面,筆者將詳細介紹如何?。 在使用基本的映像建立函數之前,需要安裝GD庫檔案。如果要使用與JPEG有關的映像建立函數,還需要安裝jpeg-6b,如果要在映像中使用Type
Time of Update: 2017-01-13
php處理檔案的上傳是很簡便的,但是假如要對上傳的圖片進行縮放處理的話,雖說能用GD來做,但是要進行比較繁瑣的處理。ImageMagick是一個影像處理包,一般的Linux軟體包中都會有的。它包含了許多處理映像的工具,它可以進行影像檔格式的轉化還可以對映像進行各種處理,其中我們將用到它的映像縮放功能。這個通過它的軟體包中的工具convert來實現,這樣來調用 convert -geometry 寬x高 源檔案 縮放後的檔案 請在目前的目錄下建立一個images的目錄,
Time of Update: 2017-01-13
php教程內建了json_encode來處理json資料,那麼它們對中文的支援不好,下面我們來看個執行個體echo
Time of Update: 2017-01-13
php教程下載jpg檔案為空白解決方案jpg格式的檔案,點擊在瀏覽器中開啟顯示為紅叉代碼如下:$filetype = "image/pjpeg";header("content-type: {$filetype}"); header("expires: 0");header("cache-control: must-revalidate,
Time of Update: 2017-01-13
iconv (“utf-8”,“gb2312//ignore”,$data)ignore的直接意思就是忽略,在此為忽略轉換時的錯誤,如果沒有ignore參數,所有該字元後面的字串都無法被儲存。conv不是php教程的預設函數,也是預設安裝的模組。需要安裝才能用的。如果是windows2000+php,你可以修改php.ini檔案,將extension=php_iconv.dll前的";"去掉,同時你要
Time of Update: 2017-01-13
sprintf將字串格式化。文法: string sprintf(string format, mixed [args]...);傳回值: 字串函式種類: 資料處理內容說明 本函式用來將字串格式化。參數 format 是轉換的格式,以百分比符號 % 開始到轉換字元為止。而在轉換的格式間依序包括了1. 填空字元。0 的話表示空格填 0;空格是內定值,表示空格就放著。 2. 對齊。內定值為向靠右對齊,負號表向靠左對齊。 3. 欄位寬度。為最小寬度。 4.
Time of Update: 2017-01-13
<?phpclass CreateHtml{ function mkdir( $prefix= ''''article'''' ) { $y = date(''''Y''''); $m = date(''''m''''); $d = date(''''d''''); $p=DIRECTORY_SEPARATOR; $filePath=''''article'''
Time of Update: 2017-01-13
<?php$d=array(array("a",-20319),array("ai",-20317),array("an",-20304),array("ang",-20295),array("ao",-20292),array("ba",-20283),array("bai",-20265),array("ban",-20257)
Time of Update: 2017-01-13
實際上是毫無作用的函數了~因為現在的網域名稱商都很滑。很多網域名稱只要註冊了,就算不使用也會被預設指向一個網域名稱商的網址。所以即便探過去,都會返回一個200值。 = = 這也是沒辦法的事。 <?php$url = ''http://www.example.com'';print_r(get_headers($url));print_r(get_headers($url, 1));?> Array( [0] => HTTP/1.1 200 OK [1] =
Time of Update: 2017-01-13
''%23 '' and passWord=''mypass id=-1 union select 1,1,1 id=-1 union select char(97),char(97),char(97) id=1 union select 1,1,1 from members id=1 union