Time of Update: 2016-07-30
使用本地的環境測試10萬次和 100萬次 緩衝的讀寫,測試環境和結果如下。環境Win7 x64 AMD7750雙核 記憶體8GApache 2.4.9PHP 5.5.12 ts vc11 memcache 2.2.7代碼functionconvert($size){$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb'); return @round($size / pow(1024, ($i = floor(log($size, 1024)))),
Time of Update: 2016-07-30
轉載自 http://blog.sina.com.cn/s/blog_73c5cfbe0101ldj8.html選擇類Ctrl+D 選中游標所佔的文本,繼續操作則會選中下一個相同的文本。Alt+F3 選中文本按下快速鍵,即可一次性選擇全部的相同文本進行同時編輯。舉個栗子:快速選中並更改所有相同的變數名、函數名等。Ctrl+L 選中整行,繼續操作則繼續選擇下一行,效果和 Shift+↓ 效果一樣。Ctrl+Shift+
Time of Update: 2016-07-30
命令列匯出資料庫:1,進入MySQL目錄下的bin檔案夾:cd MySQL中到bin檔案夾的目錄如我輸入的命令列:cd C:\Program Files\MySQL\MySQL Server 4.1\bin2,匯出資料庫:mysqldump -u 使用者名稱 -p 資料庫名 > 匯出的檔案名稱 如我輸入的命令列:mysqldump -u root -p news > news.sql
Time of Update: 2016-07-30
100) {$param_sign = md5($param_sign);}$class_sign = $class_name.'@'.$param_sign;}if (isset(self::$objSet[$class_sign])) {return self::$objSet[$class_sign];}$ref = new ReflectionClass($class_name);if ($ref->hasMethod('__construct') &&
Time of Update: 2016-07-30
Nginx + Tomcat + Memcached 的叢集至少要考慮到2個方面的問題:1. 如何?負載平衡?2. 如何?session複製與同步?本文搜集了網上相關的材料,將Nginx + Tomcat + Memcached 的叢集在window下的搭建過程總結如下。一、開發環境1. nginx版本:1.8.02. tomcat版本:7.0.553. memcached版本:1.4.134.
Time of Update: 2016-07-30
在wondow7中有時候安裝完了,一般是下載對應與php版本相同的php_mongo.dll的.連結:http://pecl.php.net/package/mongo/1.6.0RC2/windows(1)將php_mongo.dll放到ext檔案夾下。(2)修改php.ini的中的extensi '
Time of Update: 2016-07-30
/* * 方法的調用和方法重載 *//* * 什麼是方法? * 方法就是一個有名字的程式碼片段; * 方法的調用: * 在方法裡調用另外一個方法裡面的東西就是方法調用; * 或者可以認為"另外一個方法的名字()"就是方法的調用; * 方法的重載: *
Time of Update: 2016-07-30
如果你的ThinkPHP安裝在二級目錄,Nginx的偽靜態方法設定如下,其中subdir是所在的目錄名稱。location /subdir/ { if (!-e $request_filename){ rewrite ^/subdir/(.*)$ /subdir/index.php?s=$1 last; }}如果你的thinkcmf安裝在二級目錄,Nginx的偽靜態方法設定如下,其中subdir是所在的目錄名稱。location ~
Time of Update: 2016-07-30
1.動態監測查詢語句: is_numberic()、is_array、is_bool、is_double、is_string、is_object、is_integer、is_null 檢查是否期望的資料格式!2.將資料轉化為指定的格式:settype():settype(string boog | integer | float | string | array | object | null ,
Time of Update: 2016-07-30
header('Content-type:text/html;charset=utf-8'); require_once('bankList.php'); function bankInfo($card,$bankList) { $card_8 = substr($card, 0, 8); if (isset($bankList[$card_8])) { echo $bankList[$card_8]; return; } $card_6 =
Time of Update: 2016-07-30
一.原因: 做一個PHP的測試載入器,這樣可以直接測試正則。以後還可以發展這一工具。二.代碼:index.php Regex測試 Regex 檢測
Time of Update: 2016-07-30
Repository 模式為了保持代碼的整潔性和可讀性,使用Repository Pattern 是非常有用的。事實上,我們也不必僅僅為了使用這個特別的設計模式去使用Laravel,然而在下面的情境下,我們將使用OOP的架構Laravel 去展示如何使用repositories 使我們的Controller層不再那麼囉嗦、更加解耦和易讀。下面讓我們更深入的研究一下。不使用
Time of Update: 2016-07-30
原文連結:http://www.cnblogs.com/siqi/archive/2012/09/09/2667562.html1.單例模式單例模式顧名思義,就是只有一個執行個體。作為對象的建立模式, 單例模式確保某一個類只有一個執行個體,而且自行執行個體化並向整個系統提供這個執行個體。單例模式的要點有三個:一是某個類只能有一個執行個體;二是它必須自行建立這個執行個體;三是它必須自行向整個系統提供這個執行個體。為什麼要使用PHP單例模式1. php的應用主要在於資料庫應用,
Time of Update: 2016-07-30
1.下載網址:http://nginx.org/en/download.html選擇nginx-1.8.02.安裝tar zxvf nginx-1.8.0.tar.gz cd nginx-1.8.0/./configure --prefix=/home/wangpl/mine/soft/nginx-1.8.0error:./configure: error: the HTTP rewrite module requires the PCRE library.You can either
Time of Update: 2016-07-30
以下是源碼:html>head>style>.error{color:#FF0000;}style>head>body>// define variables and set to empty values$nameErr = $emailErr = $genderErr = $websiteErr = "";$name = $email = $gender = $comment = $website = "";if ($_SERVER["REQUEST_METHOD"] == "POST"){
Time of Update: 2016-07-30
遍曆檔案夾下所有檔案,一般可以使用opendir 與 readdir 方法來遍曆。例子:找出指定目錄下的所有php檔案(不搜尋子檔案夾),代碼如下:$path = dirname(__FILE__);$result = traversing($path);print_r($result);functiontraversing($path){$result = array(); if($handle = opendir($path)){ while($file=readdir(
Time of Update: 2016-07-30
擷取上月1號到最後一天的時間:echo date('Y-m-01', strtotime('-1 month'));echo '';echo date('Y-m-t', strtotime('-1 month'));和下面的echo date('Y-m-01 00:00:00', strtotime('-1 month'));echo '';echo date('Y-m-t 23:59:59', strtotime('-1 month'));著作權聲明:本文為博主原創文章,未經博主允許不得轉載。
Time of Update: 2016-07-30
php匿名函數的用法:考慮到記憶體的因素,有一些只需要調用一次的函數可以以匿名函數的形式來編寫,在使用之後即可清除之,好比便利貼一樣簡潔高效。匿名函數的特點:1.函數沒有名字,只會使用一次。2.通常會把匿名函數賦給一個變數。3.調用方式也是使用變數調用。4.調用後可立即刪除。結果: hello!結果: 10結果: 13本菜雞的第一篇博文,今後每天寫一篇,以此激勵自己進步~~著作權聲明:本文為博主原創文章,未經博主允許不得轉載。
Time of Update: 2016-07-30
PHP5.1以上版本使用Date函數是會遇到這樣的Warning:"PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of
Time of Update: 2016-07-30
摘要:本文是基於homebrew來搭建nginx+mysql+php-fpm環境的。我也是新手,有什麼設定不對的地方,還希望大家指正。安裝homebrewhomebrew是mac下非常好用的包管理器,會自動安裝相關的依賴包,將你從繁瑣的軟體依賴安裝中解放出來。 安裝homebrew也非常簡單,只要在終端中輸入:ruby -e "$(curl -fsSL