Time of Update: 2016-07-25
使用php實現檔案強制下載,多會用到header函數。 例子,php檔案下載執行個體。 class Downfile {function downserver($file_name){$file_path = "./img/".$file_name;//轉碼,檔案名稱轉為gb2312解決中文亂碼$file_name = iconv("utf-8","gb2312",$file_name);$file_path = iconv("utf-8","gb2312",$file_path);$fp =
Time of Update: 2016-07-25
php GeoIP庫使用教程什麼是GepIP ? 所謂GeoIP,就是通過來訪者的IP, 定位他的經緯度,省/地區,省市,甚至街道等位置資訊。這裡面的技術不算難題,關鍵在於有個精準 的資料庫。有了準確的資料來源就奇貨可居賺點小錢,可是發揚合作精神,集體貢獻眾人享用是我們追求的。GeoIP如何使用? 首先我們需要資料資訊,所以先擷取一個免費的資料庫:GeoIP.dat.gz ,接著解壓得到:GeoIP.dat, 然後就是對資料檔案的按需操作,這邊範例使用的是PHP。 GeoIP +
Time of Update: 2016-07-25
$link = array('百度,http://www.baidu.com/','伺服器軟體,http://s.jbxue.com/','指令碼之家,http://bbs.it-home.org/',);$str =
Time of Update: 2016-07-25
error_reporting在php編程中的使用頻度,想必大家是非常清楚的了,本文介紹error_reporting的用法,供大家學習參考。如果參數 level 未指定,當前報錯層級將被返回。下面幾項是 level 可能的值:1 E_ERROR2 E_WARNING4 E_PARSE8 E_NOTICE16 E_CORE_ERROR32 E_CORE_WARNING64 E_COMPILE_
Time of Update: 2016-07-25
雖然我是個PHP新手,但是今天看到一段代碼,忍不住修改了幾行。 class runTime { var $StartTime = 0; var $StopTime = 0; var $TimeSpent = 0; function start(){ $this->StartTime = microtime(); } function stop(){ $this->StopTime = microtime(); }
Time of Update: 2016-07-25
大家平常見的最多的是php串連mysql的類,今天給大家分享一個php串連sql server的類。感興趣的朋友可以參考下。class DB_Handle { var $ClassName = "DB_Handle"; var $Server; var $UserName; var $Password; var $Database; var $LinkID = 0; var $QueryResult = ""; var $LastInsertID
Time of Update: 2016-07-25
說明:使用curl 能快捷的抓取網頁、類比POST、GET請求,當然也不僅僅是HTTP協議的一些封裝,還支援FTP、代理、HTTPS、LDAP等應用。 curl並不是PHP特有的,很多語言中都有,一個東西好用,自然就會被推廣開,就像很多年前的log4j一樣的道理,剛開始是JAVA版本,隨後也出現log4c,log4c++??curl 也是一樣的道理。curl 並非PHP預設支援,需要在配置裡開啟此項的載入extension= php_curl.dll 在linux
Time of Update: 2016-07-25
php實現對文本資料庫的資料顯示、加入、修改、刪除、查詢五大基本操作的方法 此文本資料庫共有欄位9個: private $bankid; //銀行ID private $bankname; //銀行名稱 private $bankimg; //銀行圖片 private $bankarea; //覆蓋地區 private $bankcard; //受理卡種 private $banklimit; //支付限額 private $bankpasswd; /
Time of Update: 2016-07-25
rare內建了類自動裝載功能,當使用一個類的使用直接使用而無須require(include) 類檔案。 該類自動裝載功能非常的獨立,若你需要,可以直接在其他架構(任意php程式)中使用。 1.先引入 rareAutoLoad.class.php 2.註冊功能/** * 類自動裝載 * http://raremvc.googlecode.com * http://rare.hongtao3.com * @example * include 'rareAutoLoad.php'; *
Time of Update: 2016-07-25
function get_index($domain){ $index=array(); $url="http://www.google.com/search?source=hp&biw=1440&bih=762&q=site%3A$domain&aq=f&aqi=g10&aql=&oq="; $html=file_get_contents($url); preg_match('/[\S\s].*/Ui', $html,$index);
Time of Update: 2016-07-25
這是一個十分有用的組件,可用於產生一個資料的編輯form,他是MST Library 3.1一個十分重要的組件,可以實現dbo form和dbo form的迴圈嵌套,而且控制在一個form中,同時支援dbo form中再次嵌套自訂的widget組件。 很多PHP架構,將form的產生寫在函數,這是無可厚非的,但是你無法接收在產生一個form的時候,迴圈調用使用者函數所付出的效能成本,這時候,構建一個php和html混編的代碼,遠比迴圈執行函數的效能要高。
Time of Update: 2016-07-25
有個數組$point_history(如下),取出user_id = 3的那一行數組。代碼如下://你的數組$point_history = array(array("id"=>1,"user_id"=>1,"points"=>2),array("id"=>2,"user_id"=>3,"points"=>2),array("id"=>3,"user_id"=>3,"points"=>2),array("id"=>4,"user_id"=>3,"points"=>2),);for($row =
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
一個可擴充的php驗證類,類裡面可以的各類驗證可自行調整實現,現在為基本實現方式。需要添加規則的話, 直接定義方法,方法名即為規則名稱。具體參考使用方法。 require_once('./Validator.class.php');$data = array( 'nickname' => 'heno' , 'realname' =>
Time of Update: 2016-07-25
詳細樣本地址:http://www.alleyloft.com/contents/share?id=3 /*********************************************** *
Time of Update: 2016-07-25
/* $cache = new Cache("../cache/",20); // 建構函式,建立緩衝類對象$cache->PutCache(); // 倒出緩衝*/class Cache{private $CacheDir = ’Cache’; /* 緩衝目錄 */private $SetTimeOut = 10; /* 緩衝到期時間 */private $SetExt = ’.cache’; /* 快取檔案尾碼名 */private $CacheFileUrl = ’’; /*
Time of Update: 2016-07-25
[production]; logsresources.log.stream.writerName = "Stream"resources.log.stream.writerParams.stream = APPLICATION_PATH "/../data/logs/production.log"resources.log.stream.writerParams.mode = "a"; sessionsresources.session.save_path =
Time of Update: 2016-07-25
//第一步 建立解析器 xml_parser_create(編碼);$xml = xml_parser_create('utf-8');//xml_parser_set_option — 為指定 XML 解析進行選項設定//xml_parser_set_option($xml,XML_OPTION_CASE_FOLDING,false);
Time of Update: 2016-07-25
RewriteEngine onRewriteRule !\.(js|ico|gif|jpg|png|css)$ index.phpphp_value include_path "../lib"#------------------------------httpd.confRewriteEngine onRewriteLog "g:\ZendFramework-0.1.2\rewrite.log"RewriteRule !\.(js|ico|gif|jpg|png|css|php)$
Time of Update: 2016-07-25
struct _zval_struct {/* Variable information */zvalue_value value; /* value */zend_uint refcount__gc;zend_uchar type; /* active type */zend_uchar is_ref__gc;};複製代碼與PHP5.3之前的版本相比,引用計數欄位refcount和是否引用欄位is_ref都在其後面添加了__gc以用於新的的記憶體回收機制。