Time of Update: 2016-07-25
資料庫連接操作類 class mysql{private $_link;public function __construct($dbhost,$dbuser,$dbpassword,$dbname,$charset='utf8'){$this->_link = mysql_connect($dbhost,$dbuser,$dbpassword,true);
Time of Update: 2016-07-25
遍曆某檔案夾下的所有檔案和檔案夾方 function list_dir($dirpath){if($dirpath[strlen($dirpath)]-1!='/'){$dirpath.="/";}static $result_array=array();if(is_dir($dirpath)){$files_dirs=scandir($dirpath);foreach(
Time of Update: 2016-07-25
遍曆某檔案夾下的所有檔案和檔案夾 function list_dir($dirpath){ if($dirpath[strlen($dirpath)-1]!="\\"){$dirpath.="\\";} static $result_array=array(); if(is_dir($dirpath)){
Time of Update: 2016-07-25
本類為檔案操作類,實現了檔案的建立,寫入,刪除,修改,複製,移動,建立目錄,刪除目錄 /***本類為檔案操作類,實現了檔案的建立,寫入,刪除,修改,複製,移動,建立目錄,刪除目錄* 列出目錄裡的檔案等功能,路徑後面別忘了加"/"* * @author 路人郝* @copyright myself* @link www.phpr.cn* */class
Time of Update: 2016-07-25
利用php的mb_strlen和strlen函數就可以輕鬆得知字串的構成 是全英文、英漢混合、還是純漢字。簡要說明如下(以上樣本程式) 1、如果strlen返回的字元長度和mb_strlen以當前編碼計算的長度一 致,可以判斷是純英文字串。 2、如果strlen返回的字元長度和mb_strlen以當前編碼計算的長度不一致, 且strlen傳回值同mb_strlen的傳回值求餘後得0可以判斷為是全漢字的字串。
Time of Update: 2016-07-25
能把漢字轉化為拼音的一個函數 $d=
Time of Update: 2016-07-25
遍曆某檔案夾下的所有檔案和檔案夾 function list_dir($dirpath){ if($dirpath[strlen($dirpath)-1]!="\\"){$dirpath.="\\";} static $result_array=array(); if(is_dir($dirpath)){ $handle=opendir($dirpath); while(
Time of Update: 2016-07-25
遍曆某檔案夾下的所有檔案和檔案夾 function list_dir($dirpath){ if($dirpath[strlen($dirpath)-1]!="\\"){$dirpath.="\\";} static $result_array=array(); if(is_dir($dirpath)){
Time of Update: 2016-07-25
擷取頁面內容的一個函數 function getwebdate($url){ $tmp = str_replace('http://', '', $url); $domain = substr($tmp, 0, strpos($tmp, '/')); $path = strstr($tmp, '/'); $fp =
Time of Update: 2016-07-25
判斷訪問IP function getIP() { if (! empty ( $_SERVER ["HTTP_CLIENT_IP"] )) { $cip = $_SERVER ["HTTP_CLIENT_IP"]; } else if (! empty ( $_SERVER ["HTTP_X_FORWARDED_FOR"] )) { $cip = $_SERVER ["
Time of Update: 2016-07-25
//boolean session_encode()session_register ( 'bgcolor' );session_register ( 'fontcolor' );$id = session_id ( $usr_id );$bgcolor = "white";$fontcolor = "blue";$usr_data = session_encode ();print $usr_data;?>複製代碼
Time of Update: 2016-07-25
判斷資料庫中的欄位與檔案夾中的檔案是否對應,如果沒有對應則刪除檔案,極大的減少了佔用系統資源。 //Created on 2010-4-24 Made by Wolf QQ116311316 //作用:是判斷資料庫中的欄位與檔案夾中的檔案是否對應,如果沒有對應//則刪除檔案,極大的減少了佔用系統資源。 //$dir 是要尋找的檔案目錄 //$table 為尋找的表 //$
Time of Update: 2016-07-25
//執行個體化檔案上專類$fName=$this->_request->getPost('fName');$adapter = new Zend_File_Transfer_Adapter_Http();//存放上傳檔案的檔案夾$adapter->setDestination('/opt/lampp/htdocs/blog/upload');//上傳配置$adapter->addValidator ( 'Extension', false,
Time of Update: 2016-07-25
刪除目錄及所包含檔案函數 //注意 $dir檔案名稱 eg:admin/runtime //刪除目錄及所包含檔案函數 function deldir($dir) { //開啟檔案目錄 $dh = opendir($dir); //迴圈讀取檔案 while ($file = readdir($dh)) {
Time of Update: 2016-07-25
session_start () ; session_register ( "A" ) ; session_register ( "B" ) ; session_register ( "C" ) ; $A = "AAA"; $B = "BBB"; $C = "CCC"; $result = session_destroy () ; if ($result=1) { echo "The session is destroyed! " , "\n " ; } else
Time of Update: 2016-07-25
根據傳入參數自動產生餅圖。 /* * 產生餅形圖片 */class PieChart { private $center; //餅形中點 private $width; //餅形直徑 private $image; //繪圖物件 function __construct($width,$backcolor =
Time of Update: 2016-07-25
function dump_urls(tidy_node $node, &$urls = NULL) { $urls = (is_array($urls)) ? $urls : array(); if(isset($node->id)) { if($node->id == TIDY_TAG_A) { $urls[] = $node->attribute['href'];
Time of Update: 2016-07-25
Enter Password 複製代碼 $now = getdate(); $storetime= $now["weekday"] . " " . $now["month"] ." " . $now["year"] ; $storetime.=" Time : "; if ($now["hours"]
Time of Update: 2016-07-25
IP 地理位置查詢類 /** 檔案名稱:IpLocation.class.php* IP 地理位置查詢類 (主檔案我上傳上來了 還有一個測試檔案我上傳上來,同時還有一個QQWry.Dat這個大家可以在純真IP庫下載到 因為有6M多 所以這裡不上傳上來了)* * @author 馬秉堯 * @version 1.5 * @copyright 2005
Time of Update: 2016-07-25
看到總有人問curl的問題,這兩天沒事寫了個採集論壇的小程式。裡麵包括了類比登陸,擷取頁面原始碼,正則匹配結果等部分,希望對大家有用。 set_time_limit(0);//cookie儲存目錄$cookie_jar = '/tmp/cookie.tmp';/*函數-----------------------------------------------------