Time of Update: 2016-07-25
function Read_Excel_File2($file_name,&$result){ require_once 'include/PHPExcel/Classes/PHPExcel/IOFactory.php'; $result=null; $objReader = PHPExcel_IOFactory::createReader('Excel5'); //
Time of Update: 2016-07-25
class CommAction extends Action { public function __construct() { parent::__construct(); $this->checkAdminSession(); } public function checkAdminSession() { //設定逾時為10分 $nowtime = time(); $s_
Time of Update: 2016-07-25
function updateFirstEndFromBatchtasks(...){ static $cache=array(); $val=$$cache[$key]; if(is_null($val)){ $val=.....//擷取$val的值 $cache[$key]=$val; } }
Time of Update: 2016-07-25
伺服器的硬體設定(包括伺服器的類型、CPU、硬碟速度、記憶體大小、網卡速度等)伺服器所在的網內環境與速度 伺服器所在的網路環境與Internet骨幹網相聯的速率ChinaNet的國際出口速率訪問者的ISP (Internet存取提供者)與ChinaNet之間的專線速率訪問者的ISP (Internet存取提供者)向用戶端開放的連接埠接入速率訪問者電腦的配置,Modem的速率、電話線路的品質等
Time of Update: 2016-07-25
$now = mktime(0,0,0,date("m"),date("d"),date("Y")); echo "now is ".date("Y/m/d", $now);複製代碼顯示結果: now is 2012/05/30 顯然這不是我想要的結果。 於是,按照舊有的思維,想當然的改造成下面這個形式: $now = mktime(date("h"),date("M"),date("s"),date("m"),date("d"),date("Y")); echo "now is
Time of Update: 2016-07-25
class HtmlEncode { static $_convertToHtmlEntitiesSrcEncoding='UTF-8'; /** * 將非ASCII字串轉換成HTML實體 * * @example HtmlEncode::encode("我信了"); //輸出:我信了 * @param string $s 要進行編碼的字串
Time of Update: 2016-07-25
/** 控制器: @link jbxue.com*/class DemoController { function index() { echo('hello world'); } } /* End of file democontroller.php */複製代碼以上檔案只是建立了一個名為DemoController的對象並包含一個index的方法,該方法輸出hello world。下面在index.php中執行DemoController中index方法。 檔案:index.php
Time of Update: 2016-07-25
$file = 'a.pdf'; if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding:
Time of Update: 2016-07-25
/**功能:檢測並清除BOMlink:bbs.it-home.org*/ if(isset($_GET['dir'])){ $basedir=$_GET['dir']; }else{ $basedir = '.'; } $auto = 1; checkdir($basedir);function checkdir($basedir){ if($dh = opendir($basedir)){ while(($file = readdir($dh)) !== false){
Time of Update: 2016-07-25
class Exception{protected $message = 'Unknown exception'; // 異常資訊protected $code = 0; // 使用者自訂異常代碼protected $file; // 發生異常的檔案名稱protected $line; // 發生異常的程式碼號function __construct($message = null, $code = 0);final function getMessage(); // 返回異常資訊final
Time of Update: 2016-07-25
RewriteEngine On RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.+) index.php/$1 [L] 複製代碼
Time of Update: 2016-07-25
{some_text} {some_more_text}複製代碼它們在文檔中沒有意義,它們代表的意義只是PHP將用其他的東西來替換它。如果你同意這種對視圖的鬆散描述,你也就會同意絕大多數模板方案並沒有有效分離視圖和模型。模板標籤將被替換成什麼存放在模型中。在你實現視圖時問自己幾個問題:“全體視圖的替換容易嗎?”“實現一個新視圖要多久?” “能很容易的替換視圖的描述語言嗎?(比如在同一個視圖中用SOAP文檔替換HTML文檔)”二、模型(Model)
Time of Update: 2016-07-25
/**php時間戳記綜合應用的例子date: 2013/2/19link: http://bbs.it-home.org*/$t = time(); $t1 = mktime(0,0,0,date(“m”,$t),date(“d”,$t),date(“Y”,$t)); $t2 = mktime(0,0,0,date(“m”,$t),1,date(“Y”,$t)); $t3 = mktime(0,0,0,date(“m”,$t)-1,1,date(“Y”,$t)); $t4 = mktime(0,
Time of Update: 2016-07-25
function ip_test($ip,$iprule){ $ipruleregexp=str_replace('.*','ph',$iprule); $ipruleregexp=preg_quote($ipruleregexp,'/'); $ipruleregexp=str_replace('ph','\.[0-9]{1,3}',$ipruleregexp); if(preg_match('/^'.$ipruleregexp.'$/',$ip))
Time of Update: 2016-07-25
在生產環境中,一個巨大無比的form,包括三張圖片,幾百個輸入框,近一千個checkbox,在用post方法提交到後台時,資料被攔腰截斷。在生產環境中,一個巨大無比的form,包括三張圖片,幾百個輸入框,近一千個checkbox,在用post方法提交到後台時,資料被攔腰截斷。一路打debug,發現PHP 拿到 $_POST時,資料就不足。一開始以為是php中的post_max_size, upload_max_size的問題, 但是設成100M也不管用。後來又以為是Apache
Time of Update: 2016-07-25
連結資料庫 ------- $this->load->database();//手動串連資料庫 //串連多資料庫 $DB1 = $this->load->database('group_one', TRUE); $DB2 = $this->load->database('group_two', TRUE); 查詢 ------- //參數綁定形式 $sql = "SELECT * FROM some_table WHERE id = ? AND status = ? AND
Time of Update: 2016-07-25
public function searchArray($array,$key,$value){foreach($array as $keyp=>$valuep){if($valuep[$key]==$value){unset($array[$keyp]);}}return $array;}?>複製代碼您可能感興趣的文章:php建立數組的方法介紹php使用array_unique判斷數組中是否存在相同的值php數組函數 in_array()
Time of Update: 2016-07-25
//存入 $arr = array(1,2,3);$arr_str = serialize($arr); setcookie("a",$arr_str); //取出 $arr_str = $_COOKIE['a']; $arr = unserialize($arr_str);複製代碼方法二:設定多索引值cookie,注意必須給索引值 $arr = array(1,2,3); setcookie("a[0]", $arr[0]); setcookie("a[1]", $arr[
Time of Update: 2016-07-25
$filename='online.txt';//資料檔案$cookiename='VGOTCN_OnLineCount';//cookie名稱$onlinetime=600;//線上有效時間,單位:秒 (即600等於10分鐘)$online=file($filename);//PHP file() 函數把整個檔案讀入一個數組中。與 file_get_contents() 類似,不同的是 file()
Time of Update: 2016-07-25
擷取伺服器資訊$sysos = $_SERVER["SERVER_SOFTWARE"]; //擷取伺服器標識的字串$sysversion = PHP_VERSION; //擷取PHP伺服器版本//以下兩條代碼串連mysql資料庫並擷取MySQL資料庫版本資訊mysql_connect("localhost", "mysql_user", "mysql_pass");$mysqlinfo =