Time of Update: 2016-07-25
$start = array_sum(explode(' ', microtime())); for($i=0;$i strtotime("-1 day"); } $end = array_sum(explode(' ', microtime())); echo $end - $start ; echo ''; $start = array_sum(explode(' ',
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
$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
/** 用於UTF8編碼的程式* 獲得字串的長度,一個中文表示3個長度*/function utf8_strlen($str) {$count = 0;for($i = 0; $i $value = ord($str[$i]);if($value > 127) {$count++;if($value >= 192 && $value elseif($value >= 224 && $value elseif($value >= 240 && $value else die('Not a UTF-
Time of Update: 2016-07-25
class A{ private function __construct(){} }$a = new A();?>複製代碼程式運行結果為:Fatal error: Call to private A::__construct() from invalid context in E:\PHPProjects\test.php on line 6我們已經禁止外部用new執行個體化這個類,我們改如何讓使用者訪問這個類呢?前門堵了,我們需要給使用者留個後門。解決辦法是:static
Time of Update: 2016-07-25
echo ''; $b = array(1,1,2,3,5,8); $arr = get_defined_vars(); // 列印 $b print_r($arr["b"]); // 列印所有伺服器變數 print_r($arr["_SERVER"]); // 列印變數數組的所有可用索引值 print_r(array_keys(get_defined_vars())); ?> 複製代碼2. get_defined_functions (PHP 4 >= 4
Time of Update: 2016-07-25
開發架構是用來協助開發人員快速設計和開發**站的基礎,幾乎每個月都會有大量的架構被開發人員發布,用來協助web開發人員更簡單和高效的開發web應用。 在這篇文章中,我將總結薈萃出最佳的PHP,HTML5和CSS架構,希望能夠在大家選擇架構的時候能夠供大家參考借鑒。如果你有任何建議和補充,謝謝閱讀! PHP架構 1. Cake
Time of Update: 2016-07-25
header('Content-type: application/image/pjpeg');//輸出的類型 header('Content-Disposition: attachment; filename="downloaded.jpg"'); //下載顯示的名字,注意格式 readfile('my.jpg'); // 並將這個檔案以前面header發送資訊設定的類型輸出,從而會彈出一個下載框 //
Time of Update: 2016-07-25
複製檔案夾到另一個地方。 /** /*** 複製檔案夾 eg:將D:/wwwroot/下面wordpress複製到D:/wwwroot/www/explorer/0000/del/1/末尾都不需要加斜杠,複製到地址如果不加源檔案夾名,就會將wordpress下面檔案複製到D:/wwwroot/www/explorer/0000/del/1/下面* $from = 'D:/wwwroot/wordpress';* $to = 'D:/wwwroot/www/explorer/0000/del/
Time of Update: 2016-07-25
記錄檔較大,2個多G。沒辦法用file操作,只能按行讀取。
Time of Update: 2016-07-25
static PHP_FUNCTION(json_encode) { zval *parameter; smart_str buf = {0}; long options = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", ¶meter, &options) == FAILURE) {
Time of Update: 2016-07-25
用56網上傳組件上傳視頻,然後用api回調資料,視頻無廣告,高清壓縮。這個託管視頻的方法很實用。。 案例地址: 地址上傳組件 上傳樣本: 上傳效果 56網WIKI: 56網開放平台 用iframe框住定製的上傳頁面,嵌套到自己網站,可自由上傳,然後調用資料介面即可獲得所有上傳的視頻資訊 //header("Content-type: text/html;
Time of Update: 2016-07-25
用 PHP 實現的 Daemon 類。可以在伺服器上實現隊列或者脫離 crontab 的計劃任務。 使用的時候,繼承於這個類,並重寫 _doTask 方法,通過 main 初始化執行。 class Daemon { const DLOG_TO_CONSOLE = 1; const DLOG_NOTICE =
Time of Update: 2016-07-25
/*** php設計模式之單例模式* $_instance必須聲明為靜態私人變數* 建構函式和解構函式必須聲明為私人,防止外部程式new* 類從而失去單例模式的意義* getInstance()方法必須設定為公有的,必須調用此方法* 以返回執行個體的一個引用* ::操作符只能訪問靜態變數和靜態函數* new對象都會消耗記憶體* 使用情境:最常用的地方是資料庫連接。 * 使用單例模式產生一個對象後,* 該對象可以被其它眾多個物件所使用。 * @link
Time of Update: 2016-07-25
隨機固定長度整數以及 各種伺服器要求方法羅列 1。隨機產生整數函數(產生位元:$pw_length)public function randk($pw_length) { $randpwd = ''; for ($i=0;$i { $randpwd .= chr(mt_rand(48,57));
Time of Update: 2016-07-25
//迭代演算法function md5_1_1($data, $times = 32){//迴圈使用MD5for ($i = 0; $i $data = md5($data);}return $data;}//遞迴演算法function md5_1_2($data, $times = 32){if ($times > 0) {$data = md5($data);$times--;return md5_1_2($data, $times); //實現遞迴} else {return $data;
Time of Update: 2016-07-25
class Counter{ private static $count = 0;//定義一個靜態屬性 const VERSION = 2.0;//定義一個常量 //建構函式 function __construct(){ self::$count++; } //解構函式 function __destruct(){ self::$count--; } //定義一個靜態方法 static function getCount(){ return self::$count;
Time of Update: 2016-07-25
/*---------------------------------------= 著作權協議:= GPL (The GNU GENERAL PUBLIC LICENSE Version 2, June 1991)=------------------------------------------------------------= 檔案名稱:cls.sys_crypt.php= 摘 要:php加密解密處理類= 版 本:1.0= 參
Time of Update: 2016-07-25
如何為你的項目挑選適宜的web開發架構?首先對於一家軟體開發的創業公司而言,這更像是一個商業抉擇而不僅僅是技術選擇,時間人力物力等開銷都必須要考慮周全。一旦公司規模上來了資金不成問題了,可選擇的空間就更大了甚至可以進行遷移或重新架構。原文作者Ramigbtech總結了以下10點以供參考。譯文如下:1.文法擁有優雅文法的語言無疑可以讓編程工作變得愜意,但有時候我們容易被表象所蒙蔽,如果憑直覺你認定,"this is text".split(’ ‘).reverse.join(‘‘)比"
Time of Update: 2016-07-25
根據要求,要在九個表格中寫入文字,標題可以編輯,有天氣、背景、表情可以選擇。最後產生一個圖片,圖片可以分享,結果也可以存入資料庫。github地址:9Diary GitHub /** * 添加日誌 * bgid 背景圖片 * title 日誌標題 * 表格標題與內容以'-|*dt*|-'分隔為1、2、3、4、6、7、8、9個表格中的資訊 *