Time of Update: 2018-12-08
目前我知道的方法有兩種,一種是使用PHP的創始人 Rasmus Lerdorf 寫的APC擴充模組來實現(http://pecl.php.net/package/apc),另外一種方法是使用PECL擴充模組 uploadprogress實現(http://pecl.php.net/package/uploadprogress)我這裡舉兩個分別實現的例子供參考,更靈活的應用根據自己需要來修改。 APC實現方法: 安裝APC,參照官方文檔安裝,可以使用PECL模組安裝方法快速簡捷,這裡不說明
Time of Update: 2018-12-08
我們先看個程式碼片段: 複製代碼 代碼如下:$ip = "1.1.1.255".chr(0)."haha"; if(ereg("^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$",$ip)) { echo $ip; } else { echo "unknown"; } 這個ereg正則限制了$ip的資料為xxx.xxx.xxx.xxx這樣的形式,表面上看上面的代碼應該輸出"unknown",而實際卻輸出了"
Time of Update: 2018-12-08
//執行輸入 command 的外部程式或外部指令。返回 string 只是外部程式執行後傳回的最後一行;若需要完整地返回資訊,可以使用 PassThru() string exec(string command,string [array],int [return_var]) //用來執行指令,並輸出結果。若是 return_var 參數存在,則執行 command 之後的狀態會填入 return_var 中 string system(string command,int
Time of Update: 2018-12-08
//建立dBase資料表 int dBase_create(string filename,array fields) //開啟dBase資料表 int dbase_open(string filename,int flags) //關閉dBase資料表 boolean dbase_close(int dbase_identifier) //清理dBase資料表 bool dbase_pack(int dbase_identifier) //加入記錄到dBase資料表 bool
Time of Update: 2018-12-08
//寄出電子郵件到指定的郵件地址 to,subject 表示主題,message 為信件內容。額外的選項 additional_headers 可省略,表示其他郵件文檔首部 bool mail(string to,string subject,string message,string [additional——headers] //將 URL 字串予以解析,並將結果返回數組中。返回的數組包括下列元素:scheme、host、port、path、query 與 fragment 等 array
Time of Update: 2018-12-08
先看代碼sunip.php 複製代碼 代碼如下:<?php header("Content-type: image/gif"); $im = imagecreate(130,15); $background_color = ImageColorAllocate ($im, 255, 255, 255); unset($ip); if($_SERVER['HTTP_CLIENT_IP']){ $ip=$_SERVER['HTTP_CLIENT_IP']; } else if(
Time of Update: 2018-12-08
eAccelerator 真是一個好東西(它的前身是truck-mmcache)。 簡單來講它是一套配合PHP(支援PHP5)運作的緩衝系統,通過共用記憶體或磁碟檔案方式交換資料。 它被廣為使用的是PHP源碼“編碼”(不太貼切的稱為“加密”)和緩衝PHP執行的中間碼以加速。關於 eA 的安裝使用的文章已經很多而且也很詳細了,這次我想推薦的是用它輔助程式設計緩衝,它提供了一組API如下: 是一個非常便捷而又穩定的本機緩衝實現方式,目前這部分設計似乎只支援於共用記憶體,所以只能用於 Unix
Time of Update: 2018-12-08
選擇下載對應您的系統和PHP版本的eAccelerator 2.將其重新命名為 eaccelerator.dll (win版) 然後移至您的 php目錄下 的 ext檔案夾中 3.在c:\php\建立快取檔案夾 temp 修改許可權為 user組可讀寫 3.根據您系統的情況,一般都是PHP 擴充 ISAPI 開啟php.ini檔案, 找到extension=php_zip.dll, 在下面添加 zend_extension_ts="C:\php\ext\eaccelerator.dll"
Time of Update: 2018-12-08
官方地址:http://www.arnot.info/eaccelerator/選擇下載對應您的系統和PHP版本的eAccelerator 2.將其重新命名為 eaccelerator.dll (win版) 然後移至您的 php目錄下 的 ext檔案夾中 3.在c:\php\建立快取檔案夾 temp 修改許可權為 user組可讀寫 3.根據您系統的情況,一般都是PHP 擴充 ISAPI 開啟php.ini檔案, 找到extension=php_zip.dll, 在下面添加
Time of Update: 2018-12-08
<? function phpescape($str) { $sublen=strlen($str); $retrunString=""; for ($i=0;$i<$sublen;$i++) { if(ord($str[$i])>=127) {
Time of Update: 2018-12-08
調用代碼 <script language="javascript" src="js_bbs.php?fid=1"></script> js_bbs.php(放在根目錄下) 內容 <?php require ("bbs/config.inc.php"); //串連,選擇資料庫 $link = mysql_connect( $dbhost,$dbuser,$dbpw) or die('Could not connect:'.mysql_error());
Time of Update: 2018-12-08
昨天把php空間開通了,伺服器安裝的是php4版本,接近二十天來開始用php寫東西,自己搭建的平台都是php5,當然在寫的時候還是十分小心,因為幾乎每一段代碼的要點都是先查了參考然後寫出來的,那就麼可以看到參考裡那些是php4支援那些是php5中才新增的。結果上傳上去之後,才發現不得不修改!! 1.修改字串中的類方法調用,字串我在php5中寫成如下: $htmlstr=<<<HTML <a
Time of Update: 2018-12-08
function escape($str) { preg_match_all("/[\x80-\xff].|[\x01-\x7f]+/",$str,$r); $ar = $r[0]; foreach($ar as $k=>$v) { if(ord($v[0]) < 128) $ar[$k] = rawurlencode($v); else $ar[$k] = "%u".bin2hex(iconv("GB2312","UCS-2",$
Time of Update: 2018-12-08
字串取代。 文法: string str_replace(string needle, string str, string haystack); 傳回值: 字串 函數種類: 資料處理 內容說明 本函數將字串 str 代入 haystack 字串中,將所有的 needle 置換成 str。mlevine@adtraq.com (11-Apr-1999) 指出在 PHP 3.0.7 版,本函數有些 bug,而 nadeem@bleh.org (05-Jun-1999) 補充在 PHP 3.0.8
Time of Update: 2018-12-08
這幾天太忙,繼續連載哈哈,爭取半個月結束。 上文說到資料庫內建的不安全輸入過濾功能,但這樣的功能不是所有資料庫都有的。目前大概只有MySQL,SQLite,PostgreSQL,Sybase帶有這樣的功能,而包括Oracle和SQL Server在內的很多資料庫都沒有。
Time of Update: 2018-12-08
hb.ttf換成隨便你自己下載的ttf 複製代碼 代碼如下:<?php Header("Content-type: image/PNG");
Time of Update: 2018-12-08
<? ob_start(); ob_implicit_flush(0);<a id="more-27"></a> function CheckCanGzip(){ global $HTTP_ACCEPT_ENCODING; if (headers_sent() || connection_timeout() || connection_aborted()){ return 0; } if (strpos($HTTP_ACCEPT_ENCODING,
Time of Update: 2018-12-08
PS:這個可以舉一反三,如新雲或NB等asp文章系統都可轉為dedecms或其它php的cms 複製代碼 代碼如下:<?php //讀取mdb資料庫常式 set_time_limit(0); $conn = new com("ADODB.Connection"); $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("E:\web2\qq.mdb");
Time of Update: 2018-12-08
複製代碼 代碼如下:<?php /////////////////////////////////////////////////////////////////////////////// // // 張樹林 - 慧佳工作室 // // Module Name: woods-bhtml.php // Abstract: 產生靜態HTML處理常式尾底 // Version: 2.0 // Date
Time of Update: 2018-12-08
preg_replace 字串比對解析並取代。 文法: mixed preg_replace(mixed pattern, mixed replacement, mixed subject); 傳回值: 混合類型資料 函數種類: 資料處理 內容說明 本函數以 pattern 的規則來解析比對字串 subject,欲取而代之的字串為參數 replacement。傳回值為混合類型資料,為取代後的字串結果。 使用範例 下例傳回值為 $startDate = 6/19/1969 複製代碼