Time of Update: 2016-07-28
yum install phpredis -y如果使用Centos內建php則確保php-devel安裝 否則執行:yum install php-devel -y (不安裝的話無法載入redis擴充)串連到Redis伺服器//Connecting to Redis server on localhost redis=newRedis();redis->connect(‘127.0.0.1’, 6379); result=redis->auth(password);//密碼登陸
Time of Update: 2016-07-28
server { listen80; server_name 192.168.33.10 dev.me; root /var/www/html; indexindex.php index.html; client_max_body_size 25M; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; location / { if (!-
Time of Update: 2016-07-28
在項目根目錄下,添加 .htaccess 檔案。 檔案內容為 RewriteEngineOnOptions FollowSymLinksRewriteCond%{REQUEST_FILENAME} !-fRewriteCond%{REQUEST_FILENAME} !-dRewriteRule . index.html這是以apache作為伺服器為例的。如果是nginx作為伺服器, http://www.cnblogs.com/softidea/archive/2016/07/07/565142
Time of Update: 2016-07-28
// match 全文收索 role coding 結果是包括所有 role , coding// highlight 高亮顯示 欄位// aggs all_interests 彙總查詢// // 叢集健康 green yellow red GET /_cluster/health// 分區可以是主分區(primary shard)或者是複製分區(replica
Time of Update: 2016-07-28
背景:日積月累系列主要用於自己日常的工作中的點點滴滴,這也是我希望並鼓勵公司小夥伴們能夠做到和堅持的。作為程式員每天的工作難免會遇到種種錯誤,各種問題。不能抱有奢望每天沒有問題的心態,而應該懷揣一個勇於面對問題、剖析問題並嘗試解決問題的心,掌握解決問題之道最重要。 本篇博文簡單記錄幾個近期工作上遇到的問題,好記性不如爛筆頭,今日的記錄為了明天的事半功倍。問題總結:1. nginx配置多個靜態資源截取官方的配置樣本:Nginx locationlocation = / { [
Time of Update: 2016-07-28
關鍵字 interface 介面中不能有實現的方法不能用資料,可以有常量JAVA介面:http://blog.csdn.net/a289672082/article/details/51518398interfaceCode{//public $data=123; 錯誤 介面中不能有訪問屬性的資料const data =123;//正確 介面中可以使用常量publicfunction_print();//public function _print2(){};
Time of Update: 2016-07-28
前幾天學習了PHP加密的一些知識,現在總結一下PHP中幾種加密形式 Md5()密碼編譯演算法 Crypt()密碼編譯演算法 Sha1()密碼編譯演算法 URL編碼加密技術 Base64編碼加密技術Md5()密碼編譯演算法 文法: string md5(string $str [, bool $raw_output = false ] ) $str : 原始字串 可選(不常用) $raw_output :
Time of Update: 2016-07-28
匯入 public function excel_put(){ //先做一個檔案上傳,儲存檔案 $path=$_FILES['file']; $filePath = "uploads/".$path["name"]; move_uploaded_file($path["tmp_name"],$filePath);
Time of Update: 2016-07-28
1.Accept屬於要求標頭, Content-Type屬於實體頭。 Http前序分為通用前序,請求前序,響應前序和實體前序。 請求方的http前序結構:通用前序|請求前序|實體前序 回應程式的http前序結構:通用前序|響應前序|實體前序2.Accept代表發送端(用戶端)希望接受的資料類型。 比如:Accept:text/xml; 代表用戶端希望接受的資料類型是xml類型Content-Type代表發送端(用戶端|伺服器)發送的實體資料的資料類型。 比如:Content-Type:text/
Time of Update: 2016-07-28
1.抽象類別必須被繼承才能使用,不能直接new2.抽象類別可以有非抽象方法3.子類必須實現所有抽象方法4.與JAVA的抽象類別神似(點擊轉到)JAVA的抽象類別//抽象類別關鍵字 abstract 抽象類別不能執行個體化 必須被繼承才能使用abstractclass_parent{//抽象方法關鍵字 abstractpublicabstractfunctionfun1();//抽象類別中可以用非抽象方法publicfunctionparentfunc() {echo"Hello";
Time of Update: 2016-07-28
1.子類無法訪問父類private 屬性和方法2.不支援方法的重載<?phpclass _Parent{ //子類中無法訪問父類private屬性 protected可以 private $data = "parent"; protected $data2 = "protected data"; public function _print() { echo $this->data .
Time of Update: 2016-07-28
這個的原理是把logo‘畫’圖片的指定位置.步驟如下:1.擷取圖片和logo的基本資料 getimagesize2.判斷圖片資源類型並建立對應圖片資源 getPicType (自訂函數)3.擷取logo的位置座標 getLocal (自訂函數)4.把logo畫上去 imagecopyresampled5.輸出映像 outputImage (自訂函數)6.釋放圖片資源 imagedestroy效果: 代碼如下:/** * @function 向映像中添加logo * @param
Time of Update: 2016-07-28
安裝apache:yum install httpd httpd-devel 啟動apache:/etc/init.d/httpd start此時輸入伺服器的IP地址,應該看到apache的服務頁面,連接埠不用輸,apache預設就是使用80連接埠安裝mysql:yum install mysql mysql-server啟動mysql:/etc/init.d/mysqld start進入mysql 設定使用者名稱和密碼use mysqlset password
Time of Update: 2016-07-28
1.停止Apache Server Service httpd stop 解除安裝的PHP5.1.x的版本 Yum remove php-*安裝PHP5.3yum install php53yum install php53-cliyum install php53-commonyum install php53-develyum install php53-gdyum install php53-mbstringyum install php53-mysqlyum install
Time of Update: 2016-07-28
建立FileUtil.php檔案,內容及調用方式如下:php/** * 操縱檔案類 * * 例子: * FileUtil::createDir('a/1/2/3'); 測試建立檔案夾 建一個a/1/2/3檔案夾 * FileUtil::createFile('b/1/2/3'); 測試建立檔案 在b/1/2/檔案夾下面建一個3檔案 * FileUtil::createFile('b/1/2/3.exe')
Time of Update: 2016-07-28
Nginx讀取自訂header在參考了資料:http://stackoverflow.com/questions/8393772/how-to-get-non-standard-http-headers-on-nginxhttp://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headershttp://serverfault.com/questions/297225/nginx-passing-back-cus
Time of Update: 2016-07-28
背景nginx服務配置和使用流程說明採用http://openresty.org/cn/getting-started.html的方式發起服務的話。 其中使用的命令為: PATH=/usr/local/openresty/nginx/sbin:$PATH export PATH Then we start the nginx server with our config file this way: nginx -p pwd/ -c conf/nginx.conf
Time of Update: 2016-07-28
error_reporting(E_ALL);ini_set("display_errors", 1);伺服器設定了錯誤不提示,因此PHP文法出現問題會提示錯誤500,解決辦法也很簡單, 將錯誤資訊顯示出來, 將如上代碼貼到檔案頂部即可。').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering);
Time of Update: 2016-07-28
find()ThinkPHP find() 方法是和 select() 用法類似的一個方法,不同之處 find() 查詢出來的始終只有一條資料,即系統自動加上了 LIMIT 1 限制。當確認查詢的資料記錄只能是一條記錄時,建議使用 find() 方法查詢,如使用者登入帳號檢測:public function chekUser(){ header("Content-Type:text/html; charset=utf-8"); $Dao = M("User");
Time of Update: 2016-07-28
參考nginx開發從入門到精通:http://tengine.taobao.org/book/chapter_02.htmlkill -HUP pid(master的 pid)從容地重啟,服務不中斷master進程在接收到HUP訊號後是怎麼做的呢?