Time of Update: 2016-08-08
常用選項php -vphp -i PHP安裝的有關資訊php -h 訪問協助檔案php -m 列出編譯到當前PHP安裝的所有模組執行一段代碼php -r 'echo "hello, world!";'php -r 'echo "Hello, World!\n";'php -r '$ts = filemtime("/data/www/index.html");> echo date("F j Y H:clear:s", $ts);'php -r 'echo "Hello, world! \n\n"
Time of Update: 2016-08-08
筆者想製作一個工具,可以很快速的從git控制下的目錄中,找出所有有更改的檔案,並且形成升級包,以便於到伺服器上的升級工作。(我們需要將升級包copy到伺服器之後,直接將升級包的內容覆蓋,就可以完成升級 )以前這個升級包總是手動建立,很麻煩,尤其是如果檔案比較分散的時候,更是如此。大致思路:1. 可以使用 git diff --name-only 可以得到一個列表
Time of Update: 2016-08-08
一、cookie介紹cookie 常用於識別使用者。cookie 是伺服器留在使用者電腦中的小檔案。每當相同的電腦通過瀏覽器請求頁面時,它同時會發送 cookie。通過 PHP,您能夠建立並取回 cookie 的值。1、設定CookiePHP用SetCookie函數來設定Cookie。SetCookie函數定義了一個Cookie,並且把它附加在HTTP頭的後面,SetCookie函數的原型如下: int SetCookie(string name, string value, int
Time of Update: 2016-08-08
以下代碼基於CodeIgniter_2.1.3版用PHP向資料庫中實現簡單的增刪改查(純程式碼)請戳 http://www.cnblogs.com/corvoh/p/4641476.htmlCodeIgniter_2.1.3與PHP5.6的相容問題請戳 http://www.cnblogs.com/corvoh/p/4649357.html增://insert//文法:$bool=$this->db->insert('表名',關聯陣列);$data=array(
Time of Update: 2016-08-08
CREATE TABLE sessions ( id CHAR(32) NOT NULL, data TEXT, last_accessed TIMESTAMP NOT NULL, PRIMARY KEY (id)); colour_blue Session已儲存';} else { echo 'SESSION已存在, '.print_r($_SESSION, 1).'';}if(isset($_GET['logout'])) {
Time of Update: 2016-08-08
簡單說來:sql是關係型資料庫的結構化查詢語言 (SQL),而nosql,一般代指菲關係型資料庫,sql語句就不能用來,不過有些有leisql的查詢語言,且nosql資料庫沒有統一的查詢語言。相關參考文章閱讀:http://my.oschina.net/u/923087/blog/318997http://www.d1net.com/datacenter/tech/256374.html
Time of Update: 2016-08-08
由於工作需要,需要學習php,本來想安裝lamp的但是考慮到現在nginx伺服器有良好的效能且應用廣泛。這裡我決定搭建Linux(CentOS7+Nginx+MySQL+PHP)下的web伺服器。一、安裝httpd。yum install -y httpd 安裝完成之後使用以下命令啟動httpd服務: systemctl start httpd.service #啟動apache systemctl stop httpd.service #停止apache systemctl
Time of Update: 2016-08-08
處理百萬級以上的資料提高查詢速度的方法:1.應盡量避免在 where 子句中使用!=或<>操作符,否則將引擎放棄使用索引而進行全表掃描。 2.對查詢進行最佳化,應盡量避免全表掃描,首先應考慮在 where 及 order by 涉及的列上建立索引。 3.應盡量避免在 where 子句中對欄位進行 null 值判斷,否則將導致引擎放棄使用索引而進行全表掃描,如: select id from t where num is null
Time of Update: 2016-08-08
安裝pcre1.下載pcer-8.36.tar.gz2.解壓3.apt-get update4.apt-get install gcc5.apt-get install build-essential6./configure7.make8.make install9.下載nginx10.apt-get install zlib1g.dev11../configure12.make13.make installweb配置(多台web伺服器)1.apt-get update2.apt-get
Time of Update: 2016-08-08
c: %c d: %d f: %f', 80,80, 80, 80);echo '';printf('%0.2f %+d %0.2f ', 8, 8, 1235.456);printf('the cost of %d %s at $%0.2f each is $%0.2f.', 4, 'brooms', 8.50, (4*8.50));echo '';$tax = 30;printf('The tax rate is %0.2f%%', $tax); Sorting
Time of Update: 2016-08-08
我已經試過了,非常好用。/** * 構造ajax請求,不支援https */functionajax_http_request($url, $data = array(), $type = "post", $params = array(), $accept = "", $ua = "", $referer = "", $file = false){$http = strtolower(substr($url, 0, 7)); $type = strtolower($type); $
Time of Update: 2016-08-08
1、配置環境(1)Ubuntu14.04 x86_64 [Kernel Version: 3.16.0-30-generic](2)Apache/2.4.7(3)MySQL5.5(4)PHP5.5.92、安裝方式暫不採用源碼編譯安裝,使用apt-get install方式安裝。以後為了滿足自訂需求,最好做成deb安裝包。3、具體安裝過程(1)MySQL # apt-get install mysql-server
Time of Update: 2016-08-08
/* * 5 0101 * 9 1010 * * 5 ^ 5 * 0101 * 0101 * ----- * 0000 * 得出第一個規律: 相同的數進行異或, 結果是0 * * 9 ^ 5 ^ 6 * 1010 * 0101 * ---- * 1111 * * 1111 * 0110 * ---- * 1001 * * 9 ^ 6 ^ 5 * 1010 * 0110 * ----- * 1100 * * 1100 * 0101 * ----- * 1001 * 得到第二個規律:
Time of Update: 2016-08-08
XAMPP虛擬機器主機配置,多網域名稱綁定訪問本地網站XAMPP有時候你需要一些頂級網域名稱訪問方式來訪問你本地的項目也就是虛擬機器主機配置,這時候就需要配置虛擬機器主機,給你的目錄綁定一個網域名稱,實現多網域名稱綁定訪問。在Mac 下一直使用 MAMP 搭建本地 php 環境,因為其強大的組合配置以及方便的 UI 操作。因為公司的電腦是 Windows的,有時候需要搭建 php 環境來調試一些小東西方便自己工作,因為只是小應用,所以自己搭建本地的 WAMP 環境就沒有必要了,網上的
Time of Update: 2016-08-08
1:nginx.conf檔案內容如下:worker_processes 4; //指4核cpuevents { worker_connections 65535; //linux 下ulimit -n查看參數匹配}http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_
Time of Update: 2016-08-08
錯誤提示:A PHP Error was encounteredSeverity: NoticeMessage: Only variable references should be returned by referenceFilename: core/Common.phpLine Number: 257原代碼:return $_config[0] =& $config;修改後:$_config[0] =& $config;return $_config[0];以上內容轉載自丸迷人的部落格
Time of Update: 2016-08-08
header("Content-type: text/html; charset=utf-8"); function test($arr){$maxvalue = $arr[0];$index = 0;for($i = 1;$iif($maxvalue$maxvalue = $arr[$i];$index = $i;}}return $maxvalue; } $arr = Array(1,5,3);$max = test($arr);echo $max;?>
Time of Update: 2016-08-08
PHP 並不僅限於建立 HTML 輸出, 它也可以建立和處理包括 GIF, PNG, JPEG, WBMP 以及 XPM 在內的多種格式的映像。 更加方便的是,PHP 可以直接將映像資料流輸出到瀏覽器。 要想在 PHP 中使用影像處理功能,你需要連帶GD 庫一起來編譯 PHP。 GD 庫和 PHP 可能需要其他的庫, 這取決於你要處理的映像格式。 你可以使用 PHP 中的映像函數來擷取下列格式映像的大小: JPEG, GIF, PNG, SWF,
Time of Update: 2016-08-08
9秒學院(),源於9秒社團成立於2012年,是國內最大的移動互連網開發人員社區,社區中有60多萬遊戲開發、html5開發、開發源碼,並發布了《熱血沙城》《動漫之家》《9秒閱讀器》《進擊的9秒》《求打賞》《全民陞官》等開源項目,以及CrossApp跨平台開源引擎和fireFly遊戲伺服器引擎。“9秒學院”,推出的Html5開發課程和IOS移動遊戲開發課程,主要為上萬家合作企業輸送移動互聯產業發展緊缺開發人才,並以實際商業案例為主要授課內容,努力打造高品質的移動互聯人才服務平台。本課程主要學習基於H
Time of Update: 2016-08-08
常用的負載平衡方案有如下幾種:1、輪詢輪詢即Round Robin,根據Nginx設定檔中的順序,依次把用戶端的Web請求分發到不同的後端伺服器。配置的例子如下:http{ upstream sampleapp { server >; server <>; } .... server{ listen 80; ... location / { proxy_pass